Esempio n. 1
0
 public PaymentService(
     IConfiguration config,
     IIndex <DataStoreType, IProvideAccountData> accountDataStores,
     IIndex <PaymentScheme, IValidatePaymentRequest> paymentRequestValidators)
 {
     accountDataStore = accountDataStores[config.DataStoreType];
     this.paymentRequestValidators = paymentRequestValidators;
 }
        public PaymentServiceTests()
        {
            accountBuilder = new AccountBuilder();

            config = Substitute.For <IConfiguration>();

            accountDataStores      = Substitute.For <IIndex <DataStoreType, IProvideAccountData> >();
            accountDataStore       = Substitute.For <IProvideAccountData>();
            backupAccountDataStore = Substitute.For <IProvideAccountData>();
            accountDataStores[DataStoreType.Account].Returns(accountDataStore);
            accountDataStores[DataStoreType.BackupAccount].Returns(backupAccountDataStore);

            accountValidators = Substitute.For <IIndex <PaymentScheme, IValidatePaymentRequest> >();
            bacsValidator     = Substitute.For <IValidatePaymentRequest>();
            accountValidators[PaymentScheme.Bacs].Returns(bacsValidator);
            bacsValidator.Validate(Arg.Any <Account>(), Arg.Any <MakePaymentRequest>())
            .Returns(MakePaymentResult.Failure);
        }