< Summary

Class:Azure.Analytics.Synapse.Artifacts.Models.Notebook
Assembly:Azure.Analytics.Synapse.Artifacts
File(s):C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\Notebook.cs
C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\Notebook.Serialization.cs
Covered lines:45
Uncovered lines:65
Coverable lines:110
Total lines:231
Line coverage:40.9% (45 of 110)
Covered branches:16
Total branches:34
Branch coverage:47% (16 of 34)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Description()-0%100%
get_BigDataPool()-100%100%
get_SessionProperties()-0%100%
get_Metadata()-0%100%
get_Nbformat()-0%100%
get_NbformatMinor()-0%100%
get_Cells()-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%
DeserializeNotebook(...)-89.47%80%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\Notebook.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. </summary>
 17    public partial class Notebook : IDictionary<string, object>
 18    {
 19        /// <summary> Initializes a new instance of Notebook. </summary>
 20        /// <param name="metadata"> Notebook root-level metadata. </param>
 21        /// <param name="nbformat"> Notebook format (major number). Incremented between backwards incompatible changes t
 22        /// <param name="nbformatMinor"> Notebook format (minor number). Incremented for backward compatible changes to 
 23        /// <param name="cells"> Array of cells of the current notebook. </param>
 24        /// <exception cref="ArgumentNullException"> <paramref name="metadata"/> or <paramref name="cells"/> is null. </
 025        public Notebook(NotebookMetadata metadata, int nbformat, int nbformatMinor, IEnumerable<NotebookCell> cells)
 26        {
 027            if (metadata == null)
 28            {
 029                throw new ArgumentNullException(nameof(metadata));
 30            }
 031            if (cells == null)
 32            {
 033                throw new ArgumentNullException(nameof(cells));
 34            }
 35
 036            Metadata = metadata;
 037            Nbformat = nbformat;
 038            NbformatMinor = nbformatMinor;
 039            Cells = cells.ToList();
 040            AdditionalProperties = new ChangeTrackingDictionary<string, object>();
 041        }
 42
 43        /// <summary> Initializes a new instance of Notebook. </summary>
 44        /// <param name="description"> The description of the notebook. </param>
 45        /// <param name="bigDataPool"> Big data pool reference. </param>
 46        /// <param name="sessionProperties"> Session properties. </param>
 47        /// <param name="metadata"> Notebook root-level metadata. </param>
 48        /// <param name="nbformat"> Notebook format (major number). Incremented between backwards incompatible changes t
 49        /// <param name="nbformatMinor"> Notebook format (minor number). Incremented for backward compatible changes to 
 50        /// <param name="cells"> Array of cells of the current notebook. </param>
 51        /// <param name="additionalProperties"> . </param>
 2452        internal Notebook(string description, BigDataPoolReference bigDataPool, NotebookSessionProperties sessionPropert
 53        {
 2454            Description = description;
 2455            BigDataPool = bigDataPool;
 2456            SessionProperties = sessionProperties;
 2457            Metadata = metadata;
 2458            Nbformat = nbformat;
 2459            NbformatMinor = nbformatMinor;
 2460            Cells = cells;
 2461            AdditionalProperties = additionalProperties;
 2462        }
 63
 64        /// <summary> The description of the notebook. </summary>
 065        public string Description { get; set; }
 66        /// <summary> Big data pool reference. </summary>
 4867        public BigDataPoolReference BigDataPool { get; set; }
 68        /// <summary> Session properties. </summary>
 069        public NotebookSessionProperties SessionProperties { get; set; }
 70        /// <summary> Notebook root-level metadata. </summary>
 071        public NotebookMetadata Metadata { get; set; }
 72        /// <summary> Notebook format (major number). Incremented between backwards incompatible changes to the notebook
 073        public int Nbformat { get; set; }
 74        /// <summary> Notebook format (minor number). Incremented for backward compatible changes to the notebook format
 075        public int NbformatMinor { get; set; }
 76        /// <summary> Array of cells of the current notebook. </summary>
 077        public IList<NotebookCell> Cells { get; }
 078        internal IDictionary<string, object> AdditionalProperties { get; }
 79        /// <inheritdoc />
 080        public IEnumerator<KeyValuePair<string, object>> GetEnumerator() => AdditionalProperties.GetEnumerator();
 81        /// <inheritdoc />
 082        IEnumerator IEnumerable.GetEnumerator() => AdditionalProperties.GetEnumerator();
 83        /// <inheritdoc />
 084        public bool TryGetValue(string key, out object value) => AdditionalProperties.TryGetValue(key, out value);
 85        /// <inheritdoc />
 086        public bool ContainsKey(string key) => AdditionalProperties.ContainsKey(key);
 87        /// <inheritdoc />
 088        public ICollection<string> Keys => AdditionalProperties.Keys;
 89        /// <inheritdoc />
 090        public ICollection<object> Values => AdditionalProperties.Values;
 91        /// <inheritdoc />
 092        int ICollection<KeyValuePair<string, object>>.Count => AdditionalProperties.Count;
 93        /// <inheritdoc />
 094        public void Add(string key, object value) => AdditionalProperties.Add(key, value);
 95        /// <inheritdoc />
 096        public bool Remove(string key) => AdditionalProperties.Remove(key);
 97        /// <inheritdoc />
 098        bool ICollection<KeyValuePair<string, object>>.IsReadOnly => AdditionalProperties.IsReadOnly;
 99        /// <inheritdoc />
 0100        void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> value) => AdditionalProperties.A
 101        /// <inheritdoc />
 0102        bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> value) => AdditionalPropertie
 103        /// <inheritdoc />
 0104        bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> value) => AdditionalPropert
 105        /// <inheritdoc />
 0106        void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] destination, int offset) =>
 107        /// <inheritdoc />
 0108        void ICollection<KeyValuePair<string, object>>.Clear() => AdditionalProperties.Clear();
 109        /// <inheritdoc />
 110        public object this[string key]
 111        {
 0112            get => AdditionalProperties[key];
 0113            set => AdditionalProperties[key] = value;
 114        }
 115    }
 116}

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\Notebook.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 Notebook : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Optional.IsDefined(Description))
 20            {
 021                writer.WritePropertyName("description");
 022                writer.WriteStringValue(Description);
 23            }
 024            if (Optional.IsDefined(BigDataPool))
 25            {
 026                writer.WritePropertyName("bigDataPool");
 027                writer.WriteObjectValue(BigDataPool);
 28            }
 029            if (Optional.IsDefined(SessionProperties))
 30            {
 031                writer.WritePropertyName("sessionProperties");
 032                writer.WriteObjectValue(SessionProperties);
 33            }
 034            writer.WritePropertyName("metadata");
 035            writer.WriteObjectValue(Metadata);
 036            writer.WritePropertyName("nbformat");
 037            writer.WriteNumberValue(Nbformat);
 038            writer.WritePropertyName("nbformat_minor");
 039            writer.WriteNumberValue(NbformatMinor);
 040            writer.WritePropertyName("cells");
 041            writer.WriteStartArray();
 042            foreach (var item in Cells)
 43            {
 044                writer.WriteObjectValue(item);
 45            }
 046            writer.WriteEndArray();
 047            foreach (var item in AdditionalProperties)
 48            {
 049                writer.WritePropertyName(item.Key);
 050                writer.WriteObjectValue(item.Value);
 51            }
 052            writer.WriteEndObject();
 053        }
 54
 55        internal static Notebook DeserializeNotebook(JsonElement element)
 56        {
 2457            Optional<string> description = default;
 2458            Optional<BigDataPoolReference> bigDataPool = default;
 2459            Optional<NotebookSessionProperties> sessionProperties = default;
 2460            NotebookMetadata metadata = default;
 2461            int nbformat = default;
 2462            int nbformatMinor = default;
 2463            IList<NotebookCell> cells = default;
 2464            IDictionary<string, object> additionalProperties = default;
 2465            Dictionary<string, object> additionalPropertiesDictionary = default;
 30466            foreach (var property in element.EnumerateObject())
 67            {
 12868                if (property.NameEquals("description"))
 69                {
 070                    description = property.Value.GetString();
 071                    continue;
 72                }
 12873                if (property.NameEquals("bigDataPool"))
 74                {
 875                    bigDataPool = BigDataPoolReference.DeserializeBigDataPoolReference(property.Value);
 876                    continue;
 77                }
 12078                if (property.NameEquals("sessionProperties"))
 79                {
 2480                    sessionProperties = NotebookSessionProperties.DeserializeNotebookSessionProperties(property.Value);
 2481                    continue;
 82                }
 9683                if (property.NameEquals("metadata"))
 84                {
 2485                    metadata = NotebookMetadata.DeserializeNotebookMetadata(property.Value);
 2486                    continue;
 87                }
 7288                if (property.NameEquals("nbformat"))
 89                {
 2490                    nbformat = property.Value.GetInt32();
 2491                    continue;
 92                }
 4893                if (property.NameEquals("nbformat_minor"))
 94                {
 2495                    nbformatMinor = property.Value.GetInt32();
 2496                    continue;
 97                }
 2498                if (property.NameEquals("cells"))
 99                {
 24100                    List<NotebookCell> array = new List<NotebookCell>();
 80101                    foreach (var item in property.Value.EnumerateArray())
 102                    {
 16103                        array.Add(NotebookCell.DeserializeNotebookCell(item));
 104                    }
 24105                    cells = array;
 24106                    continue;
 107                }
 0108                additionalPropertiesDictionary ??= new Dictionary<string, object>();
 0109                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
 110            }
 24111            additionalProperties = additionalPropertiesDictionary;
 24112            return new Notebook(description.Value, bigDataPool.Value, sessionProperties.Value, metadata, nbformat, nbfor
 113        }
 114    }
 115}