Ejemplo n.º 1
0
 public void Prepare()
 {
     if (methodCode.Equals("hold"))
     {
         paymentMethodCreator = new PaymentMethodCreator(CreateHoldMethod);
     }
     else if (methodCode.Equals("directdeposit"))
     {
         tableName            = "DirectDepositAccount";
         paymentMethodCreator = new PaymentMethodCreator(CreateDirectDepositMethod);
     }
     else if (methodCode.Equals("mail"))
     {
         tableName            = "PaycheckAddress";
         paymentMethodCreator = new PaymentMethodCreator(CreateMailMethod);
     }
 }
Ejemplo n.º 2
0
        public void UseCorrectPaymentMethod_WhenCheckingOut(PaymentMethodCreator paymentMethodCreator)
        {
            // Arrange
            var paymentMethod = paymentMethodCreator(_mPaymentGateway);
            var order         = new PurchaseOrder(paymentMethod);

            // Act
            order.Checkout(20.0M);

            // Assert
            using (new FluentAssertions.Execution.AssertionScope("payments"))
            {
                Mock.Get(_mPaymentGateway).Verify(
                    pp => pp.ProcessPayment(20.0M,
                                            It.Is <IPayment>(p => p.GetType() == paymentMethod.GetType())), Times.Once);

                paymentMethod.GetType().Should().Implement <IPayment>();
            }
        }