< Summary

Class:Azure.Messaging.EventGrid.Models.EventGridEventInternal
Assembly:Azure.Messaging.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Customization\EventGridEventInternal.cs
C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\EventGridEventInternal.cs
C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\EventGridEventInternal.Serialization.cs
Covered lines:80
Uncovered lines:5
Coverable lines:85
Total lines:197
Line coverage:94.1% (80 of 85)
Covered branches:24
Total branches:28
Branch coverage:85.7% (24 of 28)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Id()-100%100%
get_Topic()-100%100%
get_Subject()-100%100%
get_EventType()-100%100%
get_EventTime()-100%100%
get_MetadataVersion()-100%100%
get_DataVersion()-100%100%
.ctor(...)-100%100%
get_Data()-100%100%
.ctor(...)-75%50%
.ctor(...)-100%100%
get_Id()-100%100%
get_Topic()-100%100%
get_Subject()-100%100%
get_EventType()-100%100%
get_EventTime()-100%100%
get_MetadataVersion()-0%100%
get_DataVersion()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeEventGridEventInternal(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Customization\EventGridEventInternal.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Text.Json;
 6using Azure.Core;
 7
 8namespace Azure.Messaging.EventGrid.Models
 9{
 10    [CodeGenModel("EventGridEvent")]
 11    internal partial class EventGridEventInternal
 12    {
 66413        public JsonElement Data { get; set; }
 14    }
 15}

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\EventGridEventInternal.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.Text.Json;
 10
 11namespace Azure.Messaging.EventGrid.Models
 12{
 13    /// <summary> Properties of an event published to an Event Grid topic using the EventGrid Schema. </summary>
 14    internal partial class EventGridEventInternal
 15    {
 16        /// <summary> Initializes a new instance of EventGridEventInternal. </summary>
 17        /// <param name="id"> An unique identifier for the event. </param>
 18        /// <param name="subject"> A resource path relative to the topic path. </param>
 19        /// <param name="data"> Event data specific to the event type. </param>
 20        /// <param name="eventType"> The type of the event that occurred. </param>
 21        /// <param name="eventTime"> The time (in UTC) the event was generated. </param>
 22        /// <param name="dataVersion"> The schema version of the data object. </param>
 23        /// <exception cref="ArgumentNullException"> <paramref name="id"/>, <paramref name="subject"/>, <paramref name="
 8024        public EventGridEventInternal(string id, string subject, JsonElement data, string eventType, DateTimeOffset even
 25        {
 8026            if (id == null)
 27            {
 028                throw new ArgumentNullException(nameof(id));
 29            }
 8030            if (subject == null)
 31            {
 032                throw new ArgumentNullException(nameof(subject));
 33            }
 8034            if (eventType == null)
 35            {
 036                throw new ArgumentNullException(nameof(eventType));
 37            }
 8038            if (dataVersion == null)
 39            {
 040                throw new ArgumentNullException(nameof(dataVersion));
 41            }
 42
 8043            Id = id;
 8044            Subject = subject;
 8045            Data = data;
 8046            EventType = eventType;
 8047            EventTime = eventTime;
 8048            DataVersion = dataVersion;
 8049        }
 50
 51        /// <summary> Initializes a new instance of EventGridEventInternal. </summary>
 52        /// <param name="id"> An unique identifier for the event. </param>
 53        /// <param name="topic"> The resource path of the event source. </param>
 54        /// <param name="subject"> A resource path relative to the topic path. </param>
 55        /// <param name="data"> Event data specific to the event type. </param>
 56        /// <param name="eventType"> The type of the event that occurred. </param>
 57        /// <param name="eventTime"> The time (in UTC) the event was generated. </param>
 58        /// <param name="metadataVersion"> The schema version of the event metadata. </param>
 59        /// <param name="dataVersion"> The schema version of the data object. </param>
 8660        internal EventGridEventInternal(string id, string topic, string subject, JsonElement data, string eventType, Dat
 61        {
 8662            Id = id;
 8663            Topic = topic;
 8664            Subject = subject;
 8665            Data = data;
 8666            EventType = eventType;
 8667            EventTime = eventTime;
 8668            MetadataVersion = metadataVersion;
 8669            DataVersion = dataVersion;
 8670        }
 71
 72        /// <summary> An unique identifier for the event. </summary>
 33273        public string Id { get; set; }
 74        /// <summary> The resource path of the event source. </summary>
 26675        public string Topic { get; set; }
 76        /// <summary> A resource path relative to the topic path. </summary>
 33277        public string Subject { get; set; }
 78        /// <summary> The type of the event that occurred. </summary>
 50079        public string EventType { get; set; }
 80        /// <summary> The time (in UTC) the event was generated. </summary>
 33281        public DateTimeOffset EventTime { get; set; }
 82        /// <summary> The schema version of the event metadata. </summary>
 083        public string MetadataVersion { get; }
 84        /// <summary> The schema version of the data object. </summary>
 33285        public string DataVersion { get; set; }
 86    }
 87}

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\EventGridEventInternal.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;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Messaging.EventGrid.Models
 13{
 14    internal partial class EventGridEventInternal : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 16018            writer.WriteStartObject();
 16019            writer.WritePropertyName("id");
 16020            writer.WriteStringValue(Id);
 16021            if (Optional.IsDefined(Topic))
 22            {
 4023                writer.WritePropertyName("topic");
 4024                writer.WriteStringValue(Topic);
 25            }
 16026            writer.WritePropertyName("subject");
 16027            writer.WriteStringValue(Subject);
 16028            writer.WritePropertyName("data");
 16029            Data.WriteTo(writer);
 16030            writer.WritePropertyName("eventType");
 16031            writer.WriteStringValue(EventType);
 16032            writer.WritePropertyName("eventTime");
 16033            writer.WriteStringValue(EventTime, "O");
 16034            writer.WritePropertyName("dataVersion");
 16035            writer.WriteStringValue(DataVersion);
 16036            writer.WriteEndObject();
 16037        }
 38
 39        internal static EventGridEventInternal DeserializeEventGridEventInternal(JsonElement element)
 40        {
 17241            string id = default;
 17242            Optional<string> topic = default;
 17243            string subject = default;
 17244            JsonElement data = default;
 17245            string eventType = default;
 17246            DateTimeOffset eventTime = default;
 17247            Optional<string> metadataVersion = default;
 17248            string dataVersion = default;
 306449            foreach (var property in element.EnumerateObject())
 50            {
 136051                if (property.NameEquals("id"))
 52                {
 17253                    id = property.Value.GetString();
 17254                    continue;
 55                }
 118856                if (property.NameEquals("topic"))
 57                {
 17258                    topic = property.Value.GetString();
 17259                    continue;
 60                }
 101661                if (property.NameEquals("subject"))
 62                {
 17263                    subject = property.Value.GetString();
 17264                    continue;
 65                }
 84466                if (property.NameEquals("data"))
 67                {
 17268                    data = property.Value.Clone();
 17269                    continue;
 70                }
 67271                if (property.NameEquals("eventType"))
 72                {
 17273                    eventType = property.Value.GetString();
 17274                    continue;
 75                }
 50076                if (property.NameEquals("eventTime"))
 77                {
 17278                    eventTime = property.Value.GetDateTimeOffset("O");
 17279                    continue;
 80                }
 32881                if (property.NameEquals("metadataVersion"))
 82                {
 15683                    metadataVersion = property.Value.GetString();
 15684                    continue;
 85                }
 17286                if (property.NameEquals("dataVersion"))
 87                {
 17288                    dataVersion = property.Value.GetString();
 89                    continue;
 90                }
 91            }
 17292            return new EventGridEventInternal(id, topic.Value, subject, data, eventType, eventTime, metadataVersion.Valu
 93        }
 94    }
 95}