public void CostOfOutingByType() { Console.WriteLine("Enetr the type of event to you want from the list provided below to see the total outings cost of outings for the event type?\n" + "Golf\n" + "Bowling\n" + "Concert\n" + "Amusement Park\n" + ""); string userInput = Console.ReadLine().ToLower(); switch (userInput) { case "golf": double golfCost = outingRepo.CostByType(EventType.Golf); Console.WriteLine("The total cost of all golf outings: $" + golfCost); break; case "bowling": double bowlingCost = outingRepo.CostByType(EventType.Bowling); Console.WriteLine("The total cost of all bowling outings: $" + bowlingCost); break; case "concert": double concertCost = outingRepo.CostByType(EventType.Concert); Console.WriteLine("The total cost of all concert outings: $" + concertCost); break; case "amusement park": double amusementPark = outingRepo.CostByType(EventType.AmusementPark); Console.WriteLine("The total cost of all AmusementPark outings: $" + amusementPark); break; default: Console.WriteLine("Plese enter an event Type from list provided"); break; } Console.WriteLine(" "); Console.WriteLine("Cost of all outings of type " + userInput + " displayed above. Press Enter to return to return to Main Menu"); Console.ReadLine(); Console.Clear(); RunMenu(); }
public void CostOfOutingsByType_Test() { //Arrange Outing newOuting1 = new Outing(EventType.AmusementPark, 18, 5.00d, 90.00d, new DateTime(2019, 9, 7)); Outing newOuting2 = new Outing(EventType.Bowling, 12, 8.00d, 96.00d, new DateTime(2019, 8, 5)); Outing newOuting3 = new Outing(EventType.Golf, 10, 12.00d, 120.00d, new DateTime(2019, 10, 27)); outingRepo.AddOuting(newOuting1); outingRepo.AddOuting(newOuting2); outingRepo.AddOuting(newOuting3); //Act double costOfAPOutings = outingRepo.CostByType(EventType.AmusementPark); double actual = costOfAPOutings; double expected = 90.00d; //Asserrt Assert.AreEqual(expected, actual); }