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 GetCostOfOutingsTypeTest() { Outing outing = new Outing("Amusement Park", new DateTime(2019, 5, 25), 35); Outing outingTwo = new Outing("Golf", new DateTime(2019, 4, 7), 25); _outingsRepo.AddOutingToList(outing); _outingsRepo.AddOutingToList(outingTwo); decimal expected = 150m * 75.00m; decimal actual = _outingsRepo.GetCostOfOutingsType(OutingType.Golf); Assert.AreEqual(expected, actual); }