Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }