public void Test_AddOuting() { //Arrange List <Outing> localList = repo.GetListOfOutings(); Outing outing = new Outing(); //Act int initialCount = localList.Count; repo.AddOuting(outing); int result = localList.Count; //Assert Assert.AreNotEqual(initialCount, result); }
public void GetOutingByDate_ShouldReturnCorrectOuting() //Read { //Arrange Outing_Repo repo = new Outing_Repo(); Outing outing = new Outing(new DateTime(2008, 3, 15), EventType.Bowling, 100, 3000m); repo.AddOuting(outing); DateTime date = new DateTime(2008, 3, 15); //Act Outing result = repo.GetOutingByDate(date); //Assert Assert.AreEqual(result.EventDate, date); }
public void AddToRepo_ShouldGetCorreBool()//Create { //Arrange Outing outing = new Outing(); Outing_Repo repo = new Outing_Repo(); //Act bool addResult = repo.AddOuting(outing); //Assert Assert.IsTrue(addResult); }
public void UpdateExistingOuting_ShouldReturnTrue() //Update { //Arrange Outing_Repo repo = new Outing_Repo(); Outing oldOuting = new Outing(new DateTime(2008, 3, 15), EventType.Bowling, 100, 3000m); repo.AddOuting(oldOuting); Outing newOuting = new Outing(new DateTime(2008, 3, 15), EventType.AmusementPark, 100, 5000m); //Act bool updateResult = repo.UpdateExistingOuting(oldOuting.EventDate, newOuting); //Assert Assert.IsTrue(updateResult); }
public void GetOutings_ShouldReturnCorrectCollection() //Read { //Arrange Outing outing = new Outing(); Outing_Repo repo = new Outing_Repo(); repo.AddOuting(outing); //Act List <Outing> outings = repo.GetAllOutings(); bool repoHasOutings = outings.Contains(outing); //Assert Assert.IsTrue(repoHasOutings); }
public void DeleteExistingOuting_ShouldReturnTrue() //Delete { //Arrange Outing_Repo repo = new Outing_Repo(); Outing outing = new Outing(new DateTime(2008, 3, 15), EventType.Bowling, 100, 3000m); repo.AddOuting(outing); DateTime date = new DateTime(2008, 3, 15); //Act Outing oldOuting = repo.GetOutingByDate(date); bool removeResult = repo.DeleteExistingOuting(oldOuting); //Assert Assert.IsTrue(removeResult); }
private void AddOuting() { Console.Clear(); // Create new instance of Outing Outing newOuting = new Outing(); // Gather properties // Type of Event Console.Write("What type of event is the outing: \n" + "1) Golf\n" + "2) Bowling\n" + "3) Amusement Park\n" + "4) Concert\n"); string typeOfEventString = Console.ReadLine(); switch (typeOfEventString) { case "1": // Golf newOuting.TypeOfEvent = EventType.Golf; break; case "2": // Bowling newOuting.TypeOfEvent = EventType.Bowling; break; case "3": // Amusement Park newOuting.TypeOfEvent = EventType.AmusementPark; break; case "4": // Concert newOuting.TypeOfEvent = EventType.Concert; break; default: // For error catching Console.WriteLine("Please enter an option listed above"); break; } // Number of people attended Console.Write("Number of people in attendance: "); string attendanceString = Console.ReadLine(); int attendanceInt = int.Parse(attendanceString); newOuting.PeopleInAttendance = attendanceInt; // Date Console.Write("Date of event: "); string dateString = Console.ReadLine(); DateTime dateDateTime = DateTime.Parse(dateString); newOuting.EventDate = dateDateTime; // Total cost per person Console.Write("Total cost per person: "); string costPerPersonString = Console.ReadLine(); decimal costPerPersonDecimal = decimal.Parse(costPerPersonString); newOuting.TotalCostPerPerson = costPerPersonDecimal; //Display total cost of event Console.WriteLine("The total cost of the event you entered is: $" + newOuting.TotalCostEvent); repo.AddOuting(newOuting); }
private void SeedOutings() { // Seed a few outings here Outing outing1 = new Outing(new DateTime(2020, 1, 30), EventType.Bowling, 50, 1500m); Outing outing2 = new Outing(new DateTime(2020, 2, 27), EventType.Bowling, 15, 500m); Outing outing3 = new Outing(new DateTime(2020, 2, 11), EventType.AmusementPark, 15, 3000m); Outing outing4 = new Outing(new DateTime(2020, 4, 04), EventType.AmusementPark, 15, 3000m); Outing outing5 = new Outing(new DateTime(2020, 7, 17), EventType.AmusementPark, 15, 3000m); Outing outing6 = new Outing(new DateTime(2020, 8, 15), EventType.Concert, 25, 3000m); Outing outing7 = new Outing(new DateTime(2020, 8, 20), EventType.Concert, 70, 5000m); Outing outing8 = new Outing(new DateTime(2020, 9, 01), EventType.Golf, 10, 600m); Outing outing9 = new Outing(new DateTime(2020, 10, 12), EventType.Golf, 7, 200m); Outing outing10 = new Outing(new DateTime(2020, 10, 22), EventType.Golf, 20, 1200m); _repo.AddOuting(outing1); _repo.AddOuting(outing2); _repo.AddOuting(outing3); _repo.AddOuting(outing4); _repo.AddOuting(outing5); _repo.AddOuting(outing6); _repo.AddOuting(outing7); _repo.AddOuting(outing8); _repo.AddOuting(outing9); _repo.AddOuting(outing10); }