示例#1
0
        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);
        }
示例#2
0
        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);
        }