public async Task AccountGroups_WhenCalled_ReturnsViewResult() { Controller sut = CreateSut(); IActionResult result = await sut.AccountGroups(); Assert.That(result, Is.TypeOf <ViewResult>()); }
public async Task AccountGroups_WhenCalled_ReturnsViewResultWhereViewNameIsEqualToAccountGroups() { Controller sut = CreateSut(); ViewResult result = (ViewResult)await sut.AccountGroups(); Assert.That(result.ViewName, Is.EqualTo("AccountGroups")); }
public async Task AccountGroups_WhenCalled_AssertQueryAsyncWasCalledOnQueryBus() { Controller sut = CreateSut(); await sut.AccountGroups(); _queryBusMock.Verify(m => m.QueryAsync <EmptyQuery, IEnumerable <IAccountGroup> >(It.IsNotNull <EmptyQuery>()), Times.Once); }
public async Task AccountGroups_WhenCalled_ReturnsViewResultWhereModelIsCollectionOfAccountGroupViewModel() { IEnumerable <IAccountGroup> accountGroupMockCollection = _fixture.CreateMany <IAccountGroup>(_random.Next(5, 10)).ToList(); Controller sut = CreateSut(accountGroupMockCollection); ViewResult result = (ViewResult)await sut.AccountGroups(); Assert.That(result.Model, Is.TypeOf <List <AccountGroupViewModel> >()); List <AccountGroupViewModel> accountGroupViewModelCollection = ((List <AccountGroupViewModel>)result.Model); Assert.That(accountGroupViewModelCollection, Is.Not.Null); Assert.That(accountGroupViewModelCollection, Is.Not.Empty); Assert.That(accountGroupViewModelCollection.Count, Is.EqualTo(accountGroupMockCollection.Count())); }