Beispiel #1
0
        public void OrderedList_Returns_Not_Null(string banknoteBuying, string result, string expected)
        {
            _TCMBService = new TCMBService(_logger);
            var response = _TCMBService.SortedBySelectedField(new CaseForNuevo.Bussiness.SearchArgs.CurrencyRateSearchArgs {
                BanknoteBuying = banknoteBuying
            });

            if (response != null)
            {
                result = "true";
            }

            var actual = result;

            Assert.Equal(expected, actual);
        }
Beispiel #2
0
        public void Run()
        {
            try
            {
                var exportFlag = false;
                Console.WriteLine(@"Do you want export after execute? Y\N");
                ConsoleKeyInfo keyInfo = Console.ReadKey();
                if (keyInfo.Key == ConsoleKey.Y)
                {
                    exportFlag = true;
                }


                Console.WriteLine(@"GetAll Method ? Press 1");
                Console.WriteLine(@"Get Method? Press 2");
                Console.WriteLine(@"SortedBySelectedField Method? Press 3");
                keyInfo = Console.ReadKey();
                if (keyInfo.Key == ConsoleKey.D1)
                {
                    var response = _service.GetAll();
                    if (exportFlag)
                    {
                        _service.ExportCSV(response);
                    }
                    _logger.LogInformation(JsonConvert.SerializeObject(response));
                    //Console.WriteLine(JsonConvert.SerializeObject(response));
                }
                if (keyInfo.Key == ConsoleKey.D2)
                {
                    var response = _service.Get(new CurrencyRateSearchArgs {
                        Name = "ABD DOLARI"
                    });
                    List <CurrencyModel> list = new List <CurrencyModel>();
                    list.Add(response);
                    if (exportFlag)
                    {
                        _service.ExportCSV(new ResponseModel {
                            Currency = list
                        });
                    }
                    _logger.LogInformation(JsonConvert.SerializeObject(response));
                }
                if (keyInfo.Key == ConsoleKey.D3)
                {
                    var response = _service.SortedBySelectedField(new CurrencyRateSearchArgs {
                        BanknoteBuying = "1"
                    });
                    if (exportFlag)
                    {
                        _service.ExportCSV(response);
                    }
                    _logger.LogInformation(JsonConvert.SerializeObject(response));
                }

                Console.ReadLine();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                throw;
            }
        }