/// <summary>
 ///     Initializes a new instance of the <see cref="DepositUseCase" /> class.
 /// </summary>
 /// <param name="accountRepository">Account Repository.</param>
 /// <param name="unitOfWork">Unit Of Work.</param>
 /// <param name="accountFactory"></param>
 /// <param name="currencyExchange"></param>
 public DepositUseCase(
     IAccountRepository accountRepository,
     IUnitOfWork unitOfWork,
     IAccountFactory accountFactory,
     ICurrencyExchange currencyExchange)
 {
     this._accountRepository = accountRepository;
     this._unitOfWork        = unitOfWork;
     this._accountFactory    = accountFactory;
     this._currencyExchange  = currencyExchange;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="DepositUseCase" /> class.
 /// </summary>
 /// <param name="accountRepository">Account Repository.</param>
 /// <param name="unitOfWork">Unit Of Work.</param>
 /// <param name="accountFactory"></param>
 /// <param name="currencyExchange"></param>
 public DepositUseCase(
     IAccountRepository accountRepository,
     IUnitOfWork unitOfWork,
     IAccountFactory accountFactory,
     ICurrencyExchange currencyExchange)
 {
     this._accountRepository = accountRepository;
     this._unitOfWork        = unitOfWork;
     this._accountFactory    = accountFactory;
     this._currencyExchange  = currencyExchange;
     this._outputPort        = new DepositPresenter();
 }
Beispiel #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="WithdrawUseCase" /> class.
 /// </summary>
 /// <param name="accountRepository">Account Repository.</param>
 /// <param name="unitOfWork">Unit Of Work.</param>
 /// <param name="accountFactory"></param>
 /// <param name="userService"></param>
 /// <param name="currencyExchange"></param>
 public WithdrawUseCase(
     IAccountRepository accountRepository,
     IUnitOfWork unitOfWork,
     IAccountFactory accountFactory,
     IUserService userService,
     ICurrencyExchange currencyExchange)
 {
     this._accountRepository = accountRepository;
     this._unitOfWork        = unitOfWork;
     this._accountFactory    = accountFactory;
     this._userService       = userService;
     this._currencyExchange  = currencyExchange;
 }
Beispiel #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DepositUseCase" /> class.
 /// </summary>
 /// <param name="accountService">Account Service.</param>
 /// <param name="depositOutputPort">Output Port.</param>
 /// <param name="accountRepository">Account Repository.</param>
 /// <param name="currencyExchange">Currency Exchange Service.</param>
 /// <param name="unitOfWork">Unit Of Work.</param>
 public DepositUseCase(
     AccountService accountService,
     IDepositOutputPort depositOutputPort,
     IAccountRepository accountRepository,
     ICurrencyExchange currencyExchange,
     IUnitOfWork unitOfWork)
 {
     this._accountService    = accountService;
     this._depositOutputPort = depositOutputPort;
     this._accountRepository = accountRepository;
     this._currencyExchange  = currencyExchange;
     this._unitOfWork        = unitOfWork;
 }
Beispiel #5
0
        private async Task <List <ITransaction> > GetTransactionsAsync(ICurrencyExchange exchange)
        {
            var lastTradeTime = this.Settings.LastTransactionTimestamp;
            var result        = new List <ITransaction>();

            for (int lastCount = -1, lastLimit = 0, limit = 10;
                 (lastCount < result.Count) && (limit <= 1000) && GetMore(lastTradeTime, result);
                 lastLimit = limit, limit *= 10)
            {
                lastCount = result.Count;
                Info("Retrieving transactions with offset={0} and limit={1}...", lastLimit, limit - lastLimit);
                result.AddRange(await exchange.GetTransactionsAsync(lastLimit, limit - lastLimit));
                Info("Retrieved {0} relevant transactions.", result.Count - lastCount);
            }

            if ((result.Count > 0) && (result[0].DateTime > this.Settings.LastTransactionTimestamp))
            {
                this.Settings.LastTransactionTimestamp = result[0].DateTime;
            }

            return(result);
        }
        /// <summary>Initializes a new instance of the <see cref="BitstampClient"/> class.</summary>
        /// <remarks>An instance initialized with this constructor can be used to access the public API only.</remarks>
        public BitstampClient()
        {
            var exchanges =
                new ICurrencyExchange[]
            {
                new BtcUsdExchange(this),
                new BtcEurExchange(this),
                new EurUsdExchange(this),
                new XrpUsdExchange(this),
                new XrpEurExchange(this),
                new XrpBtcExchange(this),
                new LtcUsdExchange(this),
                new LtcEurExchange(this),
                new LtcBtcExchange(this),
                new EthUsdExchange(this),
                new EthEurExchange(this),
                new EthBtcExchange(this),
                new BchUsdExchange(this),
                new BchEurExchange(this),
                new BchBtcExchange(this)
            };

            this.Exchanges = exchanges.ToDictionary(e => e.TickerSymbol, e => e);
        }
Beispiel #7
0
 public PaymentCommandHandler(ICurrencyExchange <ConversionRate> currencyExchange, IPaymentRepository <Payment> paymentRepository)
 {
     ICurrencyExchange <ConversionRate> _currencyExchange  = currencyExchange;
     IPaymentRepository <Payment>       _paymentRepository = paymentRepository;
 }
 private void Arrange()
 {
     _currencyExchange = new CurrencyExchange(new CurrencyCheck());
 }
 public CurrencyExchangeTest()
 {
     _currencyExchange = null;
 }
        public CurrencyExchangeTest()
        {
            var fileManager = new FileManager();

            currencyExchange = new CurrencyExchange(fileManager);
        }