public void Setup() { TransactionManager.DeleteEntities <Receipt>(); TransactionManager.DeleteEntities <Pet>(); TransactionManager.DeleteEntities <Approval>(); EmailServerServiceFactory.UseEmailServer(new MockEmailServerService()); }
public void TestRejectApproval_FiresAnEmail() { // assemble var mockEmailServer = new MockEmailServerService(); EmailServerServiceFactory.UseEmailServer(mockEmailServer); var customerEmail = "*****@*****.**"; Facade.RequestPetPurchase(customerEmail); // act var firstPendingApproval = Facade.GetPendingApprovals().FirstOrDefault(); Facade.Reject(firstPendingApproval); // assert mockEmailServer.Sent.ShouldBeTrue(); mockEmailServer.Email.To.ShouldBeEqualTo(customerEmail); mockEmailServer.Email.Message.ShouldBeEqualTo("Sorry, you have been denied."); }
public void TestAcceptPendingApproval_FiresAnEmailWithTheApproval() { // assemble var mockEmailServer = new MockEmailServerService(); EmailServerServiceFactory.UseEmailServer(mockEmailServer); var customerEmail = "*****@*****.**"; Facade.RequestPetPurchase(customerEmail); // act var firstPendingApproval = Facade.GetPendingApprovals().FirstOrDefault(); Facade.Approve(firstPendingApproval); // assert mockEmailServer.Sent.ShouldBeTrue(); mockEmailServer.Email.To.ShouldBeEqualTo(customerEmail); mockEmailServer.Email.Message.ShouldBeEqualTo("Congratulations, you've been approved and you can purchase Leo <a href='localhost:50112/Pet/PurchasePage?customerEmail=\"" + customerEmail + "\"' >Purchase Pet</a>"); }