public async Task Contributors_ShowsContributorsForSurvey() { var contributors = new ContributorsDTO(); var apiResult = A.Fake <ApiResult <ContributorsDTO> >(); A.CallTo(() => apiResult.Item).Returns(contributors); A.CallTo(() => apiResult.Succeeded).Returns(true); A.CallTo(() => _surveyService.GetSurveyContributorsAsync(A <int> .Ignored)).Returns(apiResult); var result = await _target.Contributors(12345); var viewResult = Assert.IsType <ViewResult>(result); Assert.Equal(contributors, viewResult.ViewData.Model); }
public async Task Contributors_ShowsContributorsForSurvey() { var contributors = new ContributorsDTO(); var apiResult = new Mock <ApiResult <ContributorsDTO> >(); apiResult.SetupGet(s => s.Item).Returns(contributors); apiResult.SetupGet(s => s.Succeeded).Returns(true); _surveyService.Setup(s => s.GetSurveyContributorsAsync(It.IsAny <int>())) .ReturnsAsync(apiResult.Object); var result = await _target.Contributors(12345); var viewResult = Assert.IsType <ViewResult>(result); Assert.Equal(contributors, viewResult.ViewData.Model); }