コード例 #1
0
        static void Main(string[] args)
        {
            //TODO: read input from screen ?
            DateTime effectiveDate = DateTime.Now;
            string   rateType      = "standard";
            int      resultCount   = 3;
            //TODO: get file loc from appsettings.json ?
            string fileName = "http://jsonvat.com/";

            try
            {
                string        webData       = Utilities.GetWebDataAsync(fileName).Result;
                VatRepository vatRepository = new VatRepository(webData);
                VatResolver   vatResolver   = new VatResolver(vatRepository);

                if (ValidateRateType(vatRepository.RatesValid, rateType) && vatRepository.TotalCountries > resultCount && vatRepository.TotalCountries > 0)
                {
                    OutputResults("Highest", rateType, resultCount, vatResolver.GetHighestRate(resultCount, effectiveDate, rateType));
                    OutputResults("Lowest", rateType, resultCount, vatResolver.GetLowestRate(resultCount, effectiveDate, rateType).Reverse());
                }
                else
                {
                    Console.WriteLine($"Input not valid");
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine($"Exception: {exc.ToString()}");
            }
        }
コード例 #2
0
 public UnitTests()
 {
     vatRepository            = new VatRepository(GetMockWebData());
     vatResolver              = new VatResolver(vatRepository);
     vatCountryDataCollection = vatRepository.GetVatCountryCollection();
 }