public async Task LetterHeads_WhenCalled_ReturnsViewResult() { Controller sut = CreateSut(); IActionResult result = await sut.LetterHeads(); Assert.That(result, Is.TypeOf <ViewResult>()); }
public async Task LetterHeads_WhenCalled_ReturnsViewResultWhereViewNameIsEqualToLetterHeads() { Controller sut = CreateSut(); ViewResult result = (ViewResult)await sut.LetterHeads(); Assert.That(result.ViewName, Is.EqualTo("LetterHeads")); }
public async Task LetterHeads_WhenCalled_AssertQueryAsyncWasCalledOnQueryBus() { Controller sut = CreateSut(); await sut.LetterHeads(); _queryBusMock.Verify(m => m.QueryAsync <EmptyQuery, IEnumerable <ILetterHead> >(It.IsNotNull <EmptyQuery>()), Times.Once); }
public async Task LetterHeads_WhenCalled_ReturnsViewResultWhereModelIsCollectionOfLetterHeadViewModel() { IEnumerable <ILetterHead> letterHeadMockCollection = _fixture.CreateMany <ILetterHead>(_random.Next(5, 10)).ToList(); Controller sut = CreateSut(letterHeadMockCollection); ViewResult result = (ViewResult)await sut.LetterHeads(); Assert.That(result.Model, Is.TypeOf <List <LetterHeadViewModel> >()); List <LetterHeadViewModel> letterHeadViewModelCollection = (List <LetterHeadViewModel>)result.Model; Assert.That(letterHeadViewModelCollection, Is.Not.Null); Assert.That(letterHeadViewModelCollection, Is.Not.Empty); Assert.That(letterHeadViewModelCollection.Count, Is.EqualTo(letterHeadMockCollection.Count())); }