コード例 #1
0
        public async Task NotificationHelper_SendNewEvent_TestMethod()
        {
            IOptions <EventSourcingOnAzureOptions> options = null;
            INameResolver nameResolver = null;

            var config = new ConfigurationBuilder()
                         .AddJsonFile("config.local.json")
                         .Build();

            EventSourcingOnAzureOptions optionConfig = new EventSourcingOnAzureOptions()
            {
                RaiseEventNotification = true,
                EventGridKeyValue      = @"",
                EventGridTopicEndpoint = @"https://eventstream-notifications.northeurope-1.eventgrid.azure.net/api/events"
            };

            // make a default name resolver
            nameResolver = new Microsoft.Azure.WebJobs.DefaultNameResolver(config);

            options = Options.Create <EventSourcingOnAzureOptions>(optionConfig);

            EventGridNotificationDispatcher testNotifier = new EventGridNotificationDispatcher(options, nameResolver, null);

            await testNotifier.NewEventAppended(new EventStreamAttribute("Domain Test", "Entity Type Test Two", "Instance 1234"),
                                                "Event Happened",
                                                2023);


            Assert.IsNotNull(testNotifier);
        }
        public void StringToByteArray_Empty_TestMethod()
        {
            string expected = "00-00000000000000000000000000000000-0000000000000000-00";
            string actual   = "Not set";

            actual = EventGridNotificationDispatcher.MakeTraceParent("", "");

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void MakeEventGridSubjectPart_changed_TestMethod()
        {
            string actual   = @"not set";
            string expected = @"Valid/Subject/Part";

            actual = EventGridNotificationDispatcher.MakeEventGridSubjectPart(@"Valid.Subject.Part");

            Assert.AreEqual(expected, actual);
        }