コード例 #1
0
        public async Task PaymentTerms_WhenCalled_ReturnsViewResult()
        {
            Controller sut = CreateSut();

            IActionResult result = await sut.PaymentTerms();

            Assert.That(result, Is.TypeOf <ViewResult>());
        }
コード例 #2
0
        public async Task PaymentTerms_WhenCalled_ReturnsViewResultWhereViewNameIsEqualToPaymentTerms()
        {
            Controller sut = CreateSut();

            ViewResult result = (ViewResult)await sut.PaymentTerms();

            Assert.That(result.ViewName, Is.EqualTo("PaymentTerms"));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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()));
        }