コード例 #1
0
        public void OutingsCalculator()
        {
            Console.Clear();

            OutingsContent outings = new OutingsContent();

            Console.WriteLine("1. See total cost for all outings combined \n" +
                              "2. See total cost for all outings of type GOLF \n" +
                              "3. See total cost for all outings of type BOWLING \n" +
                              "4. See total cost for all outings of type AMUSEMENT PARK \n" +
                              "5. See total cost for all outings of type CONCERT \n" +
                              "6. Back to MENU");
            string userInput = Console.ReadLine();

            switch (userInput)
            {
            case "1":
                string resultAll = _outingsRepo.CalculationsAll();
                Console.WriteLine($"Total cost for ALL events is : ${resultAll}");
                Console.ReadLine();
                break;

            case "2":
                string resultGolf = _outingsRepo.CalculationsOutingsGolf();
                Console.WriteLine($"Total cost for GOLF events is : ${resultGolf}");
                Console.ReadLine();
                break;

            case "3":
                string resultBowling = _outingsRepo.CalculationsOutingsBowling();
                Console.WriteLine($"Total cost for GOLF events is : ${resultBowling}");
                Console.ReadLine();
                break;

            case "4":
                string resultAmusementPark = _outingsRepo.CalculationsOutingsAmusementPark();
                Console.WriteLine($"Total cost for GOLF events is : ${resultAmusementPark}");
                Console.ReadLine();
                break;

            case "5":
                string resultConcerts = _outingsRepo.CalculationsOutingsConcerts();
                Console.WriteLine($"Total cost for GOLF events is : ${resultConcerts}");
                Console.ReadLine();
                break;

            case "6":
                Menu();
                break;

            default:
                Console.WriteLine("Please input a valid option");
                Console.ReadLine();
                break;
            }
            Console.Clear();
        }
コード例 #2
0
        public void Test_CalculationsOutingsBowling()
        {
            OutingsContent outingsOne = new OutingsContent(EventType.Bowling, 200, new DateTime(2020, 03, 20, 11, 20, 10), 100, 1);

            _testRepo.AddOutings(outingsOne);
            int    expected    = 1;
            string totalString = _testRepo.CalculationsOutingsBowling();
            int    total       = int.Parse(totalString);

            Assert.AreEqual(expected, total);
        }