Exemple #1
0
        public async Task EventGridServiceCompareAndSendEventAsyncReturnsSuccessForNoDifferences()
        {
            // arrange
            var existingContentPageModel = BuildValidContentPageModel();
            var updatedContentPageModel  = BuildValidContentPageModel();
            var eventGridService         = new EventGridService(fakeLogger, fakeEventGridClientService, eventGridPublishClientOptions);

            // act
            await eventGridService.CompareAndSendEventAsync(existingContentPageModel, updatedContentPageModel).ConfigureAwait(false);

            // assert
            A.CallTo(() => fakeEventGridClientService.SendEventAsync(A <List <EventGridEvent> > .Ignored, A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).MustNotHaveHappened();
        }
Exemple #2
0
        public async Task EventGridServiceCompareAndSendEventAsyncRaisesExceptionWhenNullContantPageModel()
        {
            // arrange
            var existingContentPageModel             = BuildValidContentPageModel();
            ContentPageModel?updatedContentPageModel = null;
            var eventGridService = new EventGridService(fakeLogger, fakeEventGridClientService, eventGridPublishClientOptions);

            // act
            var exceptionResult = await Assert.ThrowsAsync <ArgumentNullException>(async() => await eventGridService.CompareAndSendEventAsync(existingContentPageModel, updatedContentPageModel).ConfigureAwait(false)).ConfigureAwait(false);

            // assert
            A.CallTo(() => fakeEventGridClientService.SendEventAsync(A <List <EventGridEvent> > .Ignored, A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).MustNotHaveHappened();
            Assert.Equal("Value cannot be null. (Parameter 'updatedContentPageModel')", exceptionResult.Message);
        }