public async Task PageLocatonUpdaterFindAndUpdateAsyncDoesNotFindItemReturnsFail() { // Arrange const bool expectedResult = false; var url = new Uri("https://www.somewhere.com", UriKind.Absolute); var contentItemId = Guid.NewGuid(); var validPageLocatons = BuildValidPageLocations(Guid.NewGuid()); var service = new PageLocatonUpdater(fakeCmsApiService); // Act var result = await service.FindAndUpdateAsync(url, contentItemId, validPageLocatons).ConfigureAwait(false); // Assert A.CallTo(() => fakeCmsApiService.GetContentItemAsync <CmsApiPageLocationModel>(A <Uri> .Ignored)).MustNotHaveHappened(); Assert.Equal(expectedResult, result); }
public async Task PageLocatonUpdaterFindAndUpdateAsyncReturnsSuccess() { // Arrange const bool expectedResult = true; var url = new Uri("https://www.somewhere.com", UriKind.Absolute); var contentItemId = Guid.NewGuid(); var validPageLocatons = BuildValidPageLocations(contentItemId); var dummyCmsApiPageLocationModel = A.Dummy <CmsApiPageLocationModel>(); var service = new PageLocatonUpdater(fakeCmsApiService); A.CallTo(() => fakeCmsApiService.GetContentItemAsync <CmsApiPageLocationModel>(A <Uri> .Ignored)).Returns(dummyCmsApiPageLocationModel); // Act var result = await service.FindAndUpdateAsync(url, contentItemId, validPageLocatons).ConfigureAwait(false); // Assert A.CallTo(() => fakeCmsApiService.GetContentItemAsync <CmsApiPageLocationModel>(A <Uri> .Ignored)).MustHaveHappenedOnceExactly(); Assert.Equal(expectedResult, result); }