public void CustomerWhoNotHaveSubscriptionDoesNotGetCharged() { var repo = new Mock<ICustomerRepository>(); var charger = new Mock<ICreditCardCharger>(); var customer = new Customer() { Subscribed = false }; repo.Setup(r => r.Customers).Returns(new Customer[] { customer }); var processor = new BillingDoohickey(repo.Object, charger.Object); processor.ProcesMonth(2011, 8); charger.Verify(c => c.ChargerCustomer(customer), Times.Never); }
public void CustomerWithSubscriptionThatIsExpiredGetsCharged() { var repo = new Mock<ICustomerRepository>(); var charger = new Mock<ICreditCardCharger>(); var customer = new Customer() {Subscribed = true}; repo.Setup(r => r.Customers).Returns(new Customer[] { customer }); var processor = new BillingDoohickey(repo.Object, charger.Object); processor.ProcesMonth(2011, 8); charger.Verify(c => c.ChargerCustomer(customer), Times.Once); }