Пример #1
0
        private Invoice CalculateInvoice(RegularClient client, IList<ParkingTimeInfo> parkingTimes)
        {
            decimal timeRangePriceDay = (decimal)1.5;
            decimal timeRangePriceNight = (decimal)1.0;
            var invoice = new Invoice(client.Id);
            
            Calculate(invoice, parkingTimes, timeRangePriceDay, timeRangePriceNight);

            return invoice;

        }
        public void TestRegular()
        {
            IInvoiceCalculator calc = new InvoiceCalculator();

            Client client = new RegularClient();
            client.Id = 1;
            var parkingTimeList = new[]
            {
                new ParkingTimeInfo()
                {
                    StartTime = DateTime.Today.AddHours(8).AddMinutes(12),
                    EndTime = DateTime.Today.AddHours(10).AddMinutes(45),
                },
                new ParkingTimeInfo()
                {
                    StartTime = DateTime.Today.AddHours(19).AddMinutes(40),
                    EndTime = DateTime.Today.AddHours(20).AddMinutes(35),
                },
            };
            var invoice = calc.CalculateInvoice(client,parkingTimeList);
            Assert.AreEqual(invoice.Price,11.0m);
            Assert.IsTrue(invoice.ClientId > 0);
        }