Beispiel #1
0
        public void EventGridServiceContainsDifferencesReturnsNoDifferences()
        {
            // arrange
            const bool expectedResult           = false;
            var        existingContentPageModel = BuildValidContentPageModel();
            var        updatedContentPageModel  = BuildValidContentPageModel();

            // act
            var result = EventGridService.ContainsDifferences(existingContentPageModel, updatedContentPageModel);

            // assert
            Assert.Equal(expectedResult, result);
        }
Beispiel #2
0
        public void EventGridServiceContainsDifferencesRaisesExceptionWhenNullUpdatedContantPageModel()
        {
            // arrange
            var existingContentPageModel             = BuildValidContentPageModel();
            ContentPageModel?updatedContentPageModel = null;

            // act
            var exceptionResult = Assert.Throws <ArgumentNullException>(() => EventGridService.ContainsDifferences(existingContentPageModel, updatedContentPageModel));

            // 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);
        }
Beispiel #3
0
        public void EventGridServiceContainsDifferencesReturnsDifferencesForIsDefaultForPageLocation()
        {
            // arrange
            const bool expectedResult           = true;
            var        existingContentPageModel = BuildValidContentPageModel();
            var        updatedContentPageModel  = BuildValidContentPageModel();

            updatedContentPageModel.IsDefaultForPageLocation = !existingContentPageModel.IsDefaultForPageLocation;

            // act
            var result = EventGridService.ContainsDifferences(existingContentPageModel, updatedContentPageModel);

            // assert
            Assert.Equal(expectedResult, result);
        }
Beispiel #4
0
        public void EventGridServiceContainsDifferencesReturnsDifferencesForNullRedirectLocations2()
        {
            // arrange
            const bool expectedResult           = true;
            var        existingContentPageModel = BuildValidContentPageModel();
            var        updatedContentPageModel  = BuildValidContentPageModel();

            existingContentPageModel.RedirectLocations = null;

            // act
            var result = EventGridService.ContainsDifferences(existingContentPageModel, updatedContentPageModel);

            // assert
            Assert.Equal(expectedResult, result);
        }
Beispiel #5
0
        public void EventGridServiceContainsDifferencesReturnsDifferencesForDifferentCanonicalName()
        {
            // arrange
            const bool expectedResult           = true;
            var        existingContentPageModel = BuildValidContentPageModel();
            var        updatedContentPageModel  = BuildValidContentPageModel();

            updatedContentPageModel.CanonicalName = existingContentPageModel.CanonicalName + ".with-a-difference";

            // act
            var result = EventGridService.ContainsDifferences(existingContentPageModel, updatedContentPageModel);

            // assert
            Assert.Equal(expectedResult, result);
        }
Beispiel #6
0
        public void EventGridServiceContainsDifferencesReturnsDifferencesForDifferentRedirectLocations()
        {
            // arrange
            const bool expectedResult           = true;
            var        existingContentPageModel = BuildValidContentPageModel();
            var        updatedContentPageModel  = BuildValidContentPageModel();

            updatedContentPageModel.RedirectLocations = new List <string> {
                "/location-3", "/location-4"
            };

            // act
            var result = EventGridService.ContainsDifferences(existingContentPageModel, updatedContentPageModel);

            // assert
            Assert.Equal(expectedResult, result);
        }