예제 #1
0
        public void Setup()
        {
            TransactionManager.DeleteEntities <Receipt>();
            TransactionManager.DeleteEntities <Pet>();
            TransactionManager.DeleteEntities <Approval>();

            EmailServerServiceFactory.UseEmailServer(new MockEmailServerService());
        }
예제 #2
0
        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.");
        }
예제 #3
0
        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>");
        }