public async Task PaymentTerms_WhenCalled_ReturnsViewResult() { Controller sut = CreateSut(); IActionResult result = await sut.PaymentTerms(); Assert.That(result, Is.TypeOf <ViewResult>()); }
public async Task PaymentTerms_WhenCalled_ReturnsViewResultWhereViewNameIsEqualToPaymentTerms() { Controller sut = CreateSut(); ViewResult result = (ViewResult)await sut.PaymentTerms(); Assert.That(result.ViewName, Is.EqualTo("PaymentTerms")); }
public async Task PaymentTerms_WhenCalled_AssertQueryAsyncWasCalledOnQueryBus() { Controller sut = CreateSut(); await sut.PaymentTerms(); _queryBusMock.Verify(m => m.QueryAsync <EmptyQuery, IEnumerable <IPaymentTerm> >(It.IsNotNull <EmptyQuery>()), Times.Once); }
public async Task PaymentTerms_WhenCalled_ReturnsViewResultWhereModelIsCollectionOfPaymentTermViewModel() { IEnumerable <IPaymentTerm> paymentTermMockCollection = _fixture.CreateMany <IPaymentTerm>(_random.Next(5, 10)).ToList(); Controller sut = CreateSut(paymentTermMockCollection); ViewResult result = (ViewResult)await sut.PaymentTerms(); Assert.That(result.Model, Is.TypeOf <List <PaymentTermViewModel> >()); List <PaymentTermViewModel> paymentTermViewModellCollection = (List <PaymentTermViewModel>)result.Model; Assert.That(paymentTermViewModellCollection, Is.Not.Null); Assert.That(paymentTermViewModellCollection, Is.Not.Empty); Assert.That(paymentTermViewModellCollection.Count, Is.EqualTo(paymentTermMockCollection.Count())); }