private void CalculateCost() { Console.WriteLine("Would you like to calculate the cost for:\n" + "1. All outings\n" + "2. All outings of a certain type"); string userInput = Console.ReadLine(); switch (userInput) { case "1": decimal allCost = _outingsRepo.GetCostOfAllOutings(); Console.WriteLine($"The cost of all outings is ${allCost}."); break; case "2": Console.WriteLine("Which type of outing would you like to know the current total cost of?\n" + "Enter the number of your choice\n" + "1 = Golf, 2 = Bowling, 3 = Amusement Park, 4 = Concert"); int userEventType = int.Parse(Console.ReadLine()); decimal typeCost = _outingsRepo.GetCostOfOutingsType((OutingType)userEventType); Console.WriteLine($"The cost of all {(OutingType)userEventType} outings is {typeCost}"); break; default: Console.WriteLine("Please enter 1 or 2"); break; } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); }
public void GetCostOfAllOutingsTest() { Outing outing = new Outing("Amusement Park", new DateTime(2019, 5, 25), 35); _outingsRepo.AddOutingToList(outing); decimal expected = (125m * 75m) + (35m * 100m); decimal actual = _outingsRepo.GetCostOfAllOutings(); Assert.AreEqual(expected, actual); }