Ejemplo n.º 1
0
        public void ShouldSortByHighest(DateTime effectiveDate, int amount, List <Country> countries, ExpectedResult expectedResult)
        {
            var vatRate = new VatRate();

            vatRate.Countries.AddRange(countries);

            var lowestRates = vatRate.GetHighest(effectiveDate, amount);

            Assert.AreEqual(expectedResult.RatesCount, lowestRates.Count);
            Assert.AreEqual(expectedResult.FirstContryCode, lowestRates.FirstOrDefault()?.Code);
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Rate calculation program");

            Initialize();
            var dtoRate = await _client.GetVatRates();

            VatRate rate = Mapper.Map <VatRateDto, VatRate>(dtoRate);

            Console.WriteLine($"Getting {RateCount} lowest vat rates:\n");
            PrintAsJson(rate.GetLowest(EffectiveDateFrom, RateCount));

            Console.WriteLine(new string('-', MaxLineLngth));

            Console.WriteLine($"Getting {RateCount} highest vat rates:\n");
            PrintAsJson(rate.GetHighest(EffectiveDateFrom, RateCount));

            Console.WriteLine("Please press any key to exit the program...");
            Console.ReadKey();
        }