Ejemplo n.º 1
0
        public void CalculateTotalParkingCostOnValidNightRateEntries()
        {
            DateTime enter       = new DateTime(2017, 01, 01, 18, 0, 0);
            DateTime exit        = new DateTime(2017, 01, 02, 5, 59, 59);
            var      transaction = _engine.CalculateParkingRate(new Patron()
            {
                EnterTime = enter, ExitTime = exit
            });

            Assert.That(transaction.TransactionTotal(), Is.EqualTo((decimal)6.5));
        }
Ejemplo n.º 2
0
        private void CalculateParkingRate(DateTime enter, DateTime exit)
        {
            Console.WriteLine("{0}----> New parking [enter: {1}, exit: {2}]", Environment.NewLine, enter, exit);
            if (enter > exit)
            {
                Console.WriteLine("Invalid dates detected - cannot enter after exit!");
                return;
            }

            var patron = new Patron()
            {
                EnterTime = enter, ExitTime = exit
            };

            var transaction = _engine.CalculateParkingRate(patron);

            Console.WriteLine(transaction.Summary());
        }