Пример #1
0
        public void ShouldRedirectToSuccessfulViewWhenEligible()
        {
            var privillageCustomerService = new Mock<IPrivillageCustomerService>();
            privillageCustomerService.Setup(p => p.IsEligible(It.IsAny<Customer>())).Returns(true);
            var sut = new CustomersController(privillageCustomerService.Object);

            sut.WithCallTo(x => x.Verify(new Customer()))
                .ShouldRedirectTo(x => x.Successful);
        }
Пример #2
0
        public void ShouldRenderDefaultView()
        {
            var privillageCustomerService = new Mock<IPrivillageCustomerService>();
            var sut = new CustomersController(privillageCustomerService.Object);

            sut.WithCallTo(x => x.Index())
                .ShouldRenderDefaultView()
                .WithModel<List<Customer>>(x => x.Count() > 0);
        }
Пример #3
0
        public void ShouldRedirectToDeclinedViewOnWhenNotEligible()
        {
            var privillageCustomerService = new Mock<IPrivillageCustomerService>();
            privillageCustomerService.Setup(p => p.IsEligible(It.IsAny<Customer>())).Returns(false);
            var sut = new CustomersController(privillageCustomerService.Object);

            sut.WithCallTo(x => x.Verify(new Customer()))
                .ShouldRedirectTo(x => x.Declined);
        }