Ejemplo n.º 1
0
        public void HallEMRandNAS_Test(int startHours, int startMinutes, int endHours, int endMinutes, double expectedCost, double expectedAdvertisementCost)
        {
            var hall = new HallEMRandNAS(true);
            var cost = hall.CalculateTotalRentCost(new DateTime(2019, 09, 05, startHours, startMinutes, 00),
                                                   new DateTime(2019, 09, 05, endHours, endMinutes, 00));

            Assert.Equal(Math.Round(expectedCost, 2), Math.Round(cost, 2));

            var advertisementCost = hall.CalculateAdvertisementCost(new DateTime(2019, 09, 05, startHours, startMinutes, 00),
                                                                    new DateTime(2019, 09, 05, endHours, endMinutes, 00));

            Assert.Equal(Math.Round(expectedAdvertisementCost, 2), Math.Round(advertisementCost, 2));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var tennisCourt    = new HallEMRandAAS(true);
            var basketballHall = new HallCRSandAAS(true);

            var startTime = new DateTime(2019, 05, 09, 19, 00, 00);
            var endTime   = new DateTime(2019, 05, 09, 21, 00, 00);

            Console.WriteLine($"Start time - {startTime:yyyy-mm-dd HH:mm}. End time - {endTime:yyyy-mm-dd HH:mm}");
            Console.WriteLine($"Tennis court rent price - {tennisCourt.CalculateTotalRentCost(startTime, endTime)}");
            Console.WriteLine($"Basketball hall rent price - {basketballHall.CalculateTotalRentCost(startTime, endTime)}");

            Console.WriteLine("\n----------------------------------------------------------\n");

            var tennisCourtForMembers    = new HallEMRandNAS(false);
            var basketballHallForMembers = new HallCRSandAAS(false);

            startTime = new DateTime(2019, 05, 09, 21, 30, 00);
            endTime   = new DateTime(2019, 05, 09, 23, 00, 00);

            Console.WriteLine($"Start time - {startTime:yyyy-mm-dd HH:mm}. End time - {endTime:yyyy-mm-dd HH:mm}");

            Console.WriteLine($"Tennis court (member) rent price - {tennisCourtForMembers.CalculateTotalRentCost(startTime, endTime)}");
            Console.WriteLine($"Basketball hall (member) rent price - {basketballHallForMembers.CalculateTotalRentCost(startTime, endTime)}");

            Console.WriteLine("\n----------------------------------------------------------\n");

            var basketball         = new InventorCRS();
            var tennisBalls        = new InventorCRS();
            var tennisBallsMachine = new InventorCRS();
            var tennisRacket       = new InventorCRS();

            startTime = new DateTime(2019, 05, 09, 13, 30, 00);
            endTime   = new DateTime(2019, 05, 09, 16, 00, 00);

            Console.WriteLine($"Start time - {startTime:yyyy-mm-dd HH:mm}. End time - {endTime:yyyy-mm-dd HH:mm}");

            Console.WriteLine($"Basketball rent price - {basketball.CalculateTotalRentCost(startTime, endTime)}");
            Console.WriteLine($"Tennis balls rent price - {tennisBalls.CalculateTotalRentCost(startTime, endTime)}");
            Console.WriteLine($"Tennis balls machine rent price - {tennisBallsMachine.CalculateTotalRentCost(startTime, endTime)}");
            Console.WriteLine($"Tennis racket rent price - {tennisRacket.CalculateTotalRentCost(startTime, endTime)}");
        }