public void Should_ReturnExpectedPaymentType() { _target = new PaymentTypeStrategy(new List <IPaymentType>() { new BacsPayment(new AccountFlag()), new ChapsPayment(new AccountFlag()) }); var paymentType = _target.Get(PaymentScheme.Chaps); Assert.IsInstanceOfType(paymentType, typeof(ChapsPayment)); }
public PaymentServiceBuilder UseAvailablePaymentTypeStrategy() { var availablePaymentType = MockRepository.GenerateStub <IPaymentType>(); availablePaymentType.Stub(x => x.IsAvailable(Arg <Account> .Is.Anything, Arg <decimal> .Is.Anything)) .Return(true); _paymentTypeStrategy = MockRepository.GenerateStub <IPaymentTypeStrategy>(); _paymentTypeStrategy.Stub(x => x.Get(Arg <PaymentScheme> .Is.Anything)).Return(availablePaymentType); return(this); }
public void Should_throwAnExceptionWhenNoPaymentTypeIsAvailable() { _target = new PaymentTypeStrategy(Enumerable.Empty <IPaymentType>()); _target.Get(PaymentScheme.FasterPayments); }
public PaymentService(IDataStoreFactory dataStoreFactory, IPaymentTypeStrategy paymentTypeStrategy) { _dataStoreFactory = dataStoreFactory; _paymentTypeStrategy = paymentTypeStrategy; }
public PaymentServiceBuilder UseRealPaymentTypeStrategy() { _paymentTypeStrategy = Bootstrapper.Container.GetInstance <IPaymentTypeStrategy>(); return(this); }