Example #1
0
        public static void InitializeClass(TestContext testContext)
        {
            BankID      bankID    = BankID.Create(1);
            BankName    bankName  = BankName.Create("Ощадбанк");
            BankURI     bankURI   = BankURI.Create("https://www.oschadbank.ua/ru/private/currency/currency_rates/");
            BankPattern pattern   = BankPattern.Create(@"<td class=""text-right"">(\d+\.\d+)</td>");
            BankIndex   buyIndex  = BankIndex.Create(1);
            BankIndex   sellIndex = BankIndex.Create(2);

            exchangeRateItem = new BankInfo(bankID, bankName, bankURI, pattern, buyIndex, sellIndex); //initialize BankInfo item

            exchangeRate = new ExchangeRate();                                                        //initialize ExchangeRate class
        }
Example #2
0
        public static void Initialize(TestContext testContext)
        {
            File.Delete("BanksInfo.csv"); //delete file if it exist

            var bankID        = BankID.Create(1);
            var bankName      = BankName.Create("Укргазбанк");
            var bankURI       = BankURI.Create("https://www.ukrgasbank.com/");
            var bankPattern   = BankPattern.Create(@"<td class=""val"">(\d+\.\d+)</td>");
            var bankBuyIndex  = BankIndex.Create(0);
            var bankSellIndex = BankIndex.Create(1);

            bankInfo  = new BankInfo(bankID, bankName, bankURI, bankPattern, bankBuyIndex, bankSellIndex);
            bankInfo2 = new BankInfo(BankID.Create(2), bankName, bankURI, bankPattern, bankBuyIndex, bankSellIndex);
        }
Example #3
0
        private static BankInfo CreateBankInfo(string lineFromFile)
        {
            var items = lineFromFile.Split(',');

            items = items.Select(x => x.Trim()).ToArray();                //remove spaces in words
            items = items.Where(x => !String.IsNullOrEmpty(x)).ToArray(); //remove empty items

            if (items.Length == 6)
            {
                BankID      bankID      = BankID.Create(Convert.ToInt32(items[0]));
                BankName    bankName    = BankName.Create(items[1]);
                BankURI     bankURI     = BankURI.Create(items[2]);
                BankPattern bankPattern = BankPattern.Create(items[3]);
                BankIndex   bankBuy     = BankIndex.Create(Convert.ToInt32(items[4]));
                BankIndex   bankSell    = BankIndex.Create(Convert.ToInt32(items[5]));

                return(new BankInfo(bankID, bankName, bankURI, bankPattern, bankBuy, bankSell));
            }
            else
            {
                throw new Exception("Wrong data in file");
            }
        }
Example #4
0
 public void CreateBankIndex_LessThanZero()
 {
     var bankId = BankIndex.Create(-1);
 }