public async Task AccountingsAsync_WhenCalled_ReturnsOkObjectResult() { Controller sut = CreateSut(); ActionResult <IEnumerable <AccountingModel> > result = await sut.AccountingsAsync(); Assert.That(result.Result, Is.TypeOf <OkObjectResult>()); }
public async Task AccountingsAsync_WhenCalled_AssertQueryAsyncWasCalledOnQueryBus() { Controller sut = CreateSut(); await sut.AccountingsAsync(); _queryBusMock.Verify(m => m.QueryAsync <EmptyQuery, IEnumerable <IAccounting> >(It.IsNotNull <EmptyQuery>()), Times.Once); }
public async Task AccountingsAsync_WhenCalled_AssertOkObjectResultContainsAccountings() { IList <IAccounting> accountingMockCollection = _fixture.CreateMany <IAccounting>(_random.Next(5, 10)).ToList(); Controller sut = CreateSut(accountingMockCollection); OkObjectResult result = (OkObjectResult)(await sut.AccountingsAsync()).Result; Assert.That(result.Value, Is.Not.Null); IList <AccountingModel> accountingModels = ((IEnumerable <AccountingModel>)result.Value).ToList(); Assert.That(accountingModels, Is.Not.Null); Assert.That(accountingModels, Is.Not.Empty); Assert.That(accountingModels.Count, Is.EqualTo(accountingMockCollection.Count)); }