Exemplo n.º 1
0
        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);
        }
Exemplo n.º 3
0
        public void Should_throwAnExceptionWhenNoPaymentTypeIsAvailable()
        {
            _target = new PaymentTypeStrategy(Enumerable.Empty <IPaymentType>());

            _target.Get(PaymentScheme.FasterPayments);
        }
Exemplo n.º 4
0
 public PaymentService(IDataStoreFactory dataStoreFactory, IPaymentTypeStrategy paymentTypeStrategy)
 {
     _dataStoreFactory    = dataStoreFactory;
     _paymentTypeStrategy = paymentTypeStrategy;
 }
 public PaymentServiceBuilder UseRealPaymentTypeStrategy()
 {
     _paymentTypeStrategy = Bootstrapper.Container.GetInstance <IPaymentTypeStrategy>();
     return(this);
 }