< Summary

Class:Azure.Analytics.Synapse.Artifacts.Models.NotebookCell
Assembly:Azure.Analytics.Synapse.Artifacts
File(s):C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\NotebookCell.cs
C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\NotebookCell.Serialization.cs
Covered lines:39
Uncovered lines:62
Coverable lines:101
Total lines:217
Line coverage:38.6% (39 of 101)
Covered branches:17
Total branches:34
Branch coverage:50% (17 of 34)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_CellType()-0%100%
get_Metadata()-0%100%
get_Source()-0%100%
get_Attachments()-0%100%
get_Outputs()-0%100%
get_AdditionalProperties()-0%100%
GetEnumerator()-0%100%
System.Collections.IEnumerable.GetEnumerator()-0%100%
TryGetValue(...)-0%100%
ContainsKey(...)-0%100%
get_Keys()-0%100%
get_Values()-0%100%
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.get_Count()-0%100%
Add(...)-0%100%
Remove(...)-0%100%
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.get_IsReadOnly()-0%100%
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.Add(...)-0%100%
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.Remove(...)-0%100%
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.Contains(...)-0%100%
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.CopyTo(...)-0%100%
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.Clear()-0%100%
get_Item(...)-0%100%
set_Item(...)-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeNotebookCell(...)-93.94%94.44%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\NotebookCell.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections;
 10using System.Collections.Generic;
 11using System.Linq;
 12using Azure.Core;
 13
 14namespace Azure.Analytics.Synapse.Artifacts.Models
 15{
 16    /// <summary> Notebook cell. </summary>
 17    public partial class NotebookCell : IDictionary<string, object>
 18    {
 19        /// <summary> Initializes a new instance of NotebookCell. </summary>
 20        /// <param name="cellType"> String identifying the type of cell. </param>
 21        /// <param name="metadata"> Cell-level metadata. </param>
 22        /// <param name="source"> Contents of the cell, represented as an array of lines. </param>
 23        /// <exception cref="ArgumentNullException"> <paramref name="cellType"/>, <paramref name="metadata"/>, or <param
 024        public NotebookCell(string cellType, object metadata, IEnumerable<string> source)
 25        {
 026            if (cellType == null)
 27            {
 028                throw new ArgumentNullException(nameof(cellType));
 29            }
 030            if (metadata == null)
 31            {
 032                throw new ArgumentNullException(nameof(metadata));
 33            }
 034            if (source == null)
 35            {
 036                throw new ArgumentNullException(nameof(source));
 37            }
 38
 039            CellType = cellType;
 040            Metadata = metadata;
 041            Source = source.ToList();
 042            Outputs = new ChangeTrackingList<NotebookCellOutputItem>();
 043            AdditionalProperties = new ChangeTrackingDictionary<string, object>();
 044        }
 45
 46        /// <summary> Initializes a new instance of NotebookCell. </summary>
 47        /// <param name="cellType"> String identifying the type of cell. </param>
 48        /// <param name="metadata"> Cell-level metadata. </param>
 49        /// <param name="source"> Contents of the cell, represented as an array of lines. </param>
 50        /// <param name="attachments"> Attachments associated with the cell. </param>
 51        /// <param name="outputs"> Cell-level output items. </param>
 52        /// <param name="additionalProperties"> . </param>
 1653        internal NotebookCell(string cellType, object metadata, IList<string> source, object attachments, IList<Notebook
 54        {
 1655            CellType = cellType;
 1656            Metadata = metadata;
 1657            Source = source;
 1658            Attachments = attachments;
 1659            Outputs = outputs;
 1660            AdditionalProperties = additionalProperties;
 1661        }
 62
 63        /// <summary> String identifying the type of cell. </summary>
 064        public string CellType { get; set; }
 65        /// <summary> Cell-level metadata. </summary>
 066        public object Metadata { get; set; }
 67        /// <summary> Contents of the cell, represented as an array of lines. </summary>
 068        public IList<string> Source { get; }
 69        /// <summary> Attachments associated with the cell. </summary>
 070        public object Attachments { get; set; }
 71        /// <summary> Cell-level output items. </summary>
 072        public IList<NotebookCellOutputItem> Outputs { get; }
 073        internal IDictionary<string, object> AdditionalProperties { get; }
 74        /// <inheritdoc />
 075        public IEnumerator<KeyValuePair<string, object>> GetEnumerator() => AdditionalProperties.GetEnumerator();
 76        /// <inheritdoc />
 077        IEnumerator IEnumerable.GetEnumerator() => AdditionalProperties.GetEnumerator();
 78        /// <inheritdoc />
 079        public bool TryGetValue(string key, out object value) => AdditionalProperties.TryGetValue(key, out value);
 80        /// <inheritdoc />
 081        public bool ContainsKey(string key) => AdditionalProperties.ContainsKey(key);
 82        /// <inheritdoc />
 083        public ICollection<string> Keys => AdditionalProperties.Keys;
 84        /// <inheritdoc />
 085        public ICollection<object> Values => AdditionalProperties.Values;
 86        /// <inheritdoc />
 087        int ICollection<KeyValuePair<string, object>>.Count => AdditionalProperties.Count;
 88        /// <inheritdoc />
 089        public void Add(string key, object value) => AdditionalProperties.Add(key, value);
 90        /// <inheritdoc />
 091        public bool Remove(string key) => AdditionalProperties.Remove(key);
 92        /// <inheritdoc />
 093        bool ICollection<KeyValuePair<string, object>>.IsReadOnly => AdditionalProperties.IsReadOnly;
 94        /// <inheritdoc />
 095        void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> value) => AdditionalProperties.A
 96        /// <inheritdoc />
 097        bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> value) => AdditionalPropertie
 98        /// <inheritdoc />
 099        bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> value) => AdditionalPropert
 100        /// <inheritdoc />
 0101        void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] destination, int offset) =>
 102        /// <inheritdoc />
 0103        void ICollection<KeyValuePair<string, object>>.Clear() => AdditionalProperties.Clear();
 104        /// <inheritdoc />
 105        public object this[string key]
 106        {
 0107            get => AdditionalProperties[key];
 0108            set => AdditionalProperties[key] = value;
 109        }
 110    }
 111}

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\NotebookCell.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Analytics.Synapse.Artifacts.Models
 13{
 14    public partial class NotebookCell : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("cell_type");
 020            writer.WriteStringValue(CellType);
 021            writer.WritePropertyName("metadata");
 022            writer.WriteObjectValue(Metadata);
 023            writer.WritePropertyName("source");
 024            writer.WriteStartArray();
 025            foreach (var item in Source)
 26            {
 027                writer.WriteStringValue(item);
 28            }
 029            writer.WriteEndArray();
 030            if (Optional.IsDefined(Attachments))
 31            {
 032                writer.WritePropertyName("attachments");
 033                writer.WriteObjectValue(Attachments);
 34            }
 035            if (Optional.IsCollectionDefined(Outputs))
 36            {
 037                writer.WritePropertyName("outputs");
 038                writer.WriteStartArray();
 039                foreach (var item in Outputs)
 40                {
 041                    writer.WriteObjectValue(item);
 42                }
 043                writer.WriteEndArray();
 44            }
 045            foreach (var item in AdditionalProperties)
 46            {
 047                writer.WritePropertyName(item.Key);
 048                writer.WriteObjectValue(item.Value);
 49            }
 050            writer.WriteEndObject();
 051        }
 52
 53        internal static NotebookCell DeserializeNotebookCell(JsonElement element)
 54        {
 1655            string cellType = default;
 1656            object metadata = default;
 1657            IList<string> source = default;
 1658            Optional<object> attachments = default;
 1659            Optional<IList<NotebookCellOutputItem>> outputs = default;
 1660            IDictionary<string, object> additionalProperties = default;
 1661            Dictionary<string, object> additionalPropertiesDictionary = default;
 22462            foreach (var property in element.EnumerateObject())
 63            {
 9664                if (property.NameEquals("cell_type"))
 65                {
 1666                    cellType = property.Value.GetString();
 1667                    continue;
 68                }
 8069                if (property.NameEquals("metadata"))
 70                {
 1671                    metadata = property.Value.GetObject();
 1672                    continue;
 73                }
 6474                if (property.NameEquals("source"))
 75                {
 1676                    List<string> array = new List<string>();
 6477                    foreach (var item in property.Value.EnumerateArray())
 78                    {
 1679                        array.Add(item.GetString());
 80                    }
 1681                    source = array;
 1682                    continue;
 83                }
 4884                if (property.NameEquals("attachments"))
 85                {
 1686                    attachments = property.Value.GetObject();
 1687                    continue;
 88                }
 3289                if (property.NameEquals("outputs"))
 90                {
 1691                    List<NotebookCellOutputItem> array = new List<NotebookCellOutputItem>();
 092                    foreach (var item in property.Value.EnumerateArray())
 93                    {
 094                        array.Add(NotebookCellOutputItem.DeserializeNotebookCellOutputItem(item));
 95                    }
 1696                    outputs = array;
 1697                    continue;
 98                }
 1699                additionalPropertiesDictionary ??= new Dictionary<string, object>();
 16100                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
 101            }
 16102            additionalProperties = additionalPropertiesDictionary;
 16103            return new NotebookCell(cellType, metadata, source, attachments.Value, Optional.ToList(outputs), additionalP
 104        }
 105    }
 106}