public Reservation MakeReservation(List <Space> availableSpaces, int selectedSpaceID, int numberOfGuests, DateTime startDate, int eventLength, string venueName, string reservationName) { Space selectedSpace = null; foreach (Space space in availableSpaces) { if (space.SpaceID == selectedSpaceID) { selectedSpace = space; } } Reservation reservation = new Reservation(selectedSpace.SpaceID, venueName, selectedSpace.SpaceName, reservationName, numberOfGuests, startDate, eventLength, selectedSpace.DailyRate); return(reservationIO.AddReservationToDataBase(reservation)); }
public void TestForInsertionToDataBase() { //----- Arrange ----------------------------------------------- ReservationsDAL testObj = new ReservationsDAL(connectionString); Reservation dummyReservation = new Reservation(4, "My Test Venue Name", "My Testy Space Name", "JoEli ColinSall", 2, new DateTime(2020, 1, 1), 1, 500); //----- Act --------------------------------------------------- int startingRowCount = GetRowCount("reservation"); Reservation testReservation = testObj.AddReservationToDataBase(dummyReservation); int endingRowCount = GetRowCount("city"); //----- Assert ------------------------------------------------ Assert.AreNotEqual(startingRowCount, endingRowCount); }