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); } }
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>(); } }