< Summary

Class:Azure.DigitalTwins.Core.EventRoute
Assembly:Azure.DigitalTwins.Core
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\EventRoute.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\EventRoute.Serialization.cs
Covered lines:33
Uncovered lines:1
Coverable lines:34
Total lines:100
Line coverage:97% (33 of 34)
Covered branches:11
Total branches:12
Branch coverage:91.6% (11 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_Id()-100%100%
get_EndpointName()-100%100%
get_Filter()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeEventRoute(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\EventRoute.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;
 9
 10namespace Azure.DigitalTwins.Core
 11{
 12    /// <summary> A route which directs notification and telemetry events to an endpoint. Endpoints are a destination ou
 13    public partial class EventRoute
 14    {
 15        /// <summary> Initializes a new instance of EventRoute. </summary>
 16        /// <param name="endpointName"> The name of the endpoint this event route is bound to. </param>
 17        /// <exception cref="ArgumentNullException"> <paramref name="endpointName"/> is null. </exception>
 1218        public EventRoute(string endpointName)
 19        {
 1220            if (endpointName == null)
 21            {
 022                throw new ArgumentNullException(nameof(endpointName));
 23            }
 24
 1225            EndpointName = endpointName;
 1226        }
 27
 28        /// <summary> Initializes a new instance of EventRoute. </summary>
 29        /// <param name="id"> The id of the event route. </param>
 30        /// <param name="endpointName"> The name of the endpoint this event route is bound to. </param>
 31        /// <param name="filter"> An expression which describes the events which are routed to the endpoint. </param>
 832        internal EventRoute(string id, string endpointName, string filter)
 33        {
 834            Id = id;
 835            EndpointName = endpointName;
 836            Filter = filter;
 837        }
 38
 39        /// <summary> The id of the event route. </summary>
 840        public string Id { get; }
 41        /// <summary> The name of the endpoint this event route is bound to. </summary>
 4842        public string EndpointName { get; set; }
 43        /// <summary> An expression which describes the events which are routed to the endpoint. </summary>
 6044        public string Filter { get; set; }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\EventRoute.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.DigitalTwins.Core
 12{
 13    public partial class EventRoute : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1217            writer.WriteStartObject();
 1218            writer.WritePropertyName("endpointName");
 1219            writer.WriteStringValue(EndpointName);
 1220            if (Optional.IsDefined(Filter))
 21            {
 1222                writer.WritePropertyName("filter");
 1223                writer.WriteStringValue(Filter);
 24            }
 1225            writer.WriteEndObject();
 1226        }
 27
 28        internal static EventRoute DeserializeEventRoute(JsonElement element)
 29        {
 830            Optional<string> id = default;
 831            string endpointName = default;
 832            Optional<string> filter = default;
 6433            foreach (var property in element.EnumerateObject())
 34            {
 2435                if (property.NameEquals("id"))
 36                {
 837                    id = property.Value.GetString();
 838                    continue;
 39                }
 1640                if (property.NameEquals("endpointName"))
 41                {
 842                    endpointName = property.Value.GetString();
 843                    continue;
 44                }
 845                if (property.NameEquals("filter"))
 46                {
 847                    filter = property.Value.GetString();
 48                    continue;
 49                }
 50            }
 851            return new EventRoute(id.Value, endpointName, filter.Value);
 52        }
 53    }
 54}