public async Task PagesControlerHelpersTestsGetContentPageAsyncReturnsSuccess() { // Arrange var expectedResults = A.CollectionOfDummy <ContentPageModel>(1); const string location = "a-location"; const string article = "an-article"; var helper = new PagesControlerHelpers(fakeContentPageService); A.CallTo(() => fakeContentPageService.GetAsync(A <Expression <Func <ContentPageModel, bool> > > .Ignored)).Returns(expectedResults); // Act var result = await helper.GetContentPageAsync(location, article).ConfigureAwait(false); // Assert A.CallTo(() => fakeContentPageService.GetAsync(A <Expression <Func <ContentPageModel, bool> > > .Ignored)).MustHaveHappenedOnceExactly(); Assert.Equal(expectedResults.First(), result); }
public async Task PagesControlerHelpersTestsGetContentPageAsyncReturnsNull() { // Arrange List <ContentPageModel>?expectedResults = null; const string location = "a-location"; const string article = "an-article"; var helper = new PagesControlerHelpers(fakeContentPageService); A.CallTo(() => fakeContentPageService.GetAsync(A <Expression <Func <ContentPageModel, bool> > > .Ignored)).Returns(expectedResults); // Act var result = await helper.GetContentPageAsync(location, article).ConfigureAwait(false); // Assert A.CallTo(() => fakeContentPageService.GetAsync(A <Expression <Func <ContentPageModel, bool> > > .Ignored)).MustHaveHappenedTwiceExactly(); Assert.Null(result); }