< Summary

Class:Azure.Messaging.EventGrid.EventGridEvent
Assembly:Azure.Messaging.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Customization\EventGridEvent.cs
Covered lines:17
Uncovered lines:0
Coverable lines:17
Total lines:51
Line coverage:100% (17 of 17)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_Id()-100%100%
get_Topic()-100%100%
get_Subject()-100%100%
get_Data()-100%100%
get_EventType()-100%100%
get_EventTime()-100%100%
get_DataVersion()-100%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6
 7namespace Azure.Messaging.EventGrid
 8{
 9    /// <summary> Properties of an event published to an Event Grid topic using the EventGrid Schema. </summary>
 10    public class EventGridEvent
 11    {
 12        /// <summary> Initializes a new instance of EventGridEvent. </summary>
 13        /// <param name="subject"> A resource path relative to the topic path. </param>
 14        /// <param name="data"> Event data specific to the event type. </param>
 15        /// <param name="eventType"> The type of the event that occurred. </param>
 16        /// <param name="dataVersion"> The schema version of the data object. </param>
 33217        public EventGridEvent(string subject, object data, string eventType, string dataVersion)
 18        {
 33219            Argument.AssertNotNull(subject, nameof(subject));
 33220            Argument.AssertNotNull(data, nameof(data));
 33221            Argument.AssertNotNull(eventType, nameof(eventType));
 33222            Argument.AssertNotNull(dataVersion, nameof(dataVersion));
 23
 33224            Subject = subject;
 33225            Data = data;
 33226            EventType = eventType;
 33227            DataVersion = dataVersion;
 33228        }
 29
 30        /// <summary> An unique identifier for the event. </summary>
 82431        public string Id { get; set; } = Guid.NewGuid().ToString();
 32
 33        /// <summary> The resource path of the event source. </summary>
 20034        public string Topic { get; set; }
 35
 36        /// <summary> A resource path relative to the topic path. </summary>
 49237        public string Subject { get; set; }
 38
 39        /// <summary> Event data specific to the event type. </summary>
 99240        public object Data { get; set; }
 41
 42        /// <summary> The type of the event that occurred. </summary>
 49243        public string EventType { get; set; }
 44
 45        /// <summary> The time (in UTC) the event was generated. </summary>
 82446        public DateTimeOffset EventTime { get; set; } = DateTimeOffset.UtcNow;
 47
 48        /// <summary> The schema version of the data object. </summary>
 49249        public string DataVersion { get; set; }
 50    }
 51}