< Summary

Class:Azure.DigitalTwins.Core.RelationshipCollection
Assembly:Azure.DigitalTwins.Core
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\RelationshipCollection.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\RelationshipCollection.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\RelationshipCollection.cs
Covered lines:19
Uncovered lines:5
Coverable lines:24
Total lines:98
Line coverage:79.1% (19 of 24)
Covered branches:11
Total branches:12
Branch coverage:91.6% (11 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_NextLink()-100%100%
.ctor(...)-100%100%
get_Value()-100%100%
.ctor()-0%100%
DeserializeRelationshipCollection(...)-92.86%91.67%
.ctor()-0%100%
.ctor(...)-100%100%
get_NextLink()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\RelationshipCollection.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using Azure.Core;
 6
 7namespace Azure.DigitalTwins.Core
 8{
 9    [CodeGenModel("RelationshipCollection")]
 10    internal partial class RelationshipCollection
 11    {
 12        // This class declaration makes the generated class of the same name use IReadOnlyList<string> instead of IReadO
 13        // makes the class internal, and changes the namespace; do not remove.
 14
 815        internal IReadOnlyList<string> Value { get; }
 16    }
 017}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\RelationshipCollection.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using System.Text.Json;
 6
 7namespace Azure.DigitalTwins.Core
 8{
 9    internal partial class RelationshipCollection
 10    {
 11        // This class declaration makes the generated class of the same name internal instead of public; do not remove.
 12        // It also overrides deserialization implementation in order to treat the **object** type definition for "value"
 13
 14        internal static RelationshipCollection DeserializeRelationshipCollection(JsonElement element)
 15        {
 816            IReadOnlyList<string> value = default;
 817            string nextLink = default;
 4818            foreach (var property in element.EnumerateObject())
 19            {
 1620                if (property.NameEquals("value"))
 21                {
 822                    if (property.Value.ValueKind == JsonValueKind.Null)
 23                    {
 24                        continue;
 25                    }
 826                    List<string> array = new List<string>();
 4027                    foreach (var item in property.Value.EnumerateArray())
 28                    {
 29                        // manual change: get json text
 1230                        array.Add(item.GetRawText());
 31                    }
 832                    value = array;
 833                    continue;
 34                }
 835                if (property.NameEquals("nextLink"))
 36                {
 837                    if (property.Value.ValueKind == JsonValueKind.Null)
 38                    {
 39                        continue;
 40                    }
 041                    nextLink = property.Value.GetString();
 42                    continue;
 43                }
 44            }
 845            return new RelationshipCollection(value, nextLink);
 46        }
 47    }
 48}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\RelationshipCollection.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 Azure.Core;
 10
 11namespace Azure.DigitalTwins.Core
 12{
 13    /// <summary> A collection of relationships which relate digital twins together. </summary>
 14    internal partial class RelationshipCollection
 15    {
 16        /// <summary> Initializes a new instance of RelationshipCollection. </summary>
 017        internal RelationshipCollection()
 18        {
 019            Value = new ChangeTrackingList<string>();
 020        }
 21
 22        /// <summary> Initializes a new instance of RelationshipCollection. </summary>
 23        /// <param name="value"> The relationship objects. </param>
 24        /// <param name="nextLink"> A URI to retrieve the next page of objects. </param>
 425        internal RelationshipCollection(IReadOnlyList<string> value, string nextLink)
 26        {
 427            Value = value;
 428            NextLink = nextLink;
 429        }
 30        /// <summary> A URI to retrieve the next page of objects. </summary>
 431        public string NextLink { get; }
 32    }
 33}