Example #1
0
        public async Task <DateTime?> CalculateTransfer(string sourceIban = null, string targetIban = null)
        {
            DateTime?result = null;

            if (!string.IsNullOrEmpty(sourceIban))
            {
                var sourceId = elixirLogic.GetBankIdFromIBAN(sourceIban);
                Source = Banks.Where(b => b.Identifier == sourceId).FirstOrDefault();
            }

            if (!string.IsNullOrEmpty(targetIban))
            {
                var targetId = elixirLogic.GetBankIdFromIBAN(targetIban);
                Target = Banks.Where(b => b.Identifier == targetId).FirstOrDefault();
            }

            try
            {
                result = await elixirLogic.GetTransferTime(SendTime, Source, Target);
            }
            catch (ArgumentException ex)
            {
                OnPropertyChanged("BankInvalid");
            }

            return(result);
        }
Example #2
0
        public void GetTransferTime_ShouldGet()
        {
            var source = new BankModel()
            {
                BankName   = "Alior Bank",
                Identifier = "249"
            };

            var target = new BankModel()
            {
                BankName   = "Bank BPH",
                Identifier = "106"
            };

            var result = elixirLogic.GetTransferTime(new DateTime(2016, 1, 1, 12, 0, 0), source, target).Result;

            Assert.AreEqual(result, new DateTime(2016, 1, 1, 10, 0, 0));
        }