public void CreateReservationTest() { // Arrange IReservationDAO dao = new ReservationSqlDAO(connection); // Act Reservation r = new Reservation() { SiteID = 2, Name = "Ryan Family Reservation", FromDate = DateTime.Now, ToDate = DateTime.Now, CreateDate = DateTime.Now }; Reservation r2 = new Reservation() { SiteID = 3, Name = "Bauer Family Reservation", FromDate = DateTime.Now, ToDate = DateTime.Now, CreateDate = DateTime.Now }; int thisOneIs45 = dao.CreateReservation(r); int thisOneIs46 = dao.CreateReservation(r2); // Assert Assert.AreEqual(45, thisOneIs45); Assert.AreEqual(46, thisOneIs46); Assert.AreEqual(46, dao.GetAllReservations().Count); }
public void CreateReservation_Should_ReturnNewReservationId() { // Arrange ReservationSqlDAO dao = new ReservationSqlDAO(ConnectionString); // Act int returnedId = dao.CreateReservation(SiteId, "Test Name", DateTime.Now.AddDays(1), DateTime.Now.AddDays(3)); // Assert Assert.AreEqual(ReservationId + 1, returnedId); }
public void CreateReservationTest() { //arrange ReservationSqlDAO dao = new ReservationSqlDAO(connectionString); //act DateTime startDate = new DateTime(2019, 10, 19); DateTime endDate = new DateTime(2019, 10, 21); int reservationId = dao.CreateReservation(1, "Voldemort", startDate, endDate); //assert Assert.AreEqual(47, reservationId); }
public void CreateReservation_ShouldIncreaseCountby1() { Reservation reservation = new Reservation(); reservation.FromDate = Convert.ToDateTime("2019-02-14"); reservation.ToDate = Convert.ToDateTime("2019-02-16"); reservation.Name = "Marky Mark and the Funky Bunch"; reservation.SiteId = this.SiteId; ReservationSqlDAO dao = new ReservationSqlDAO(ConnectionString); dao.CreateReservation(reservation); IList <Reservation> reservationList = dao.GetAllReservations(this.SiteId); Assert.AreEqual(2, reservationList.Count); }
public void CreateReservationsTest_should_IncreaseCountBy1() { ReservationSqlDAO dao = new ReservationSqlDAO(ConnectionString); int initalRowCount = GetRowCount("reservation"); Reservation res = new Reservation() { SiteId = SiteId, Name = "C Sharp Reunion", FromDate = Convert.ToDateTime("08-15-2019"), ToDate = Convert.ToDateTime("08-20-2019") }; dao.CreateReservation(res); int finalRowCount = GetRowCount("reservation"); Assert.AreEqual(initalRowCount + 1, finalRowCount); }
public void SeeIfReservationWasCreated_ReturnID() { ReservationSqlDAO dao = new ReservationSqlDAO(ConnectionString); Reservation reservation = new Reservation(); reservation.Create_date = Convert.ToDateTime("2019/02/25"); reservation.From_Date = Convert.ToDateTime("2019/03/03"); reservation.To_Date = Convert.ToDateTime("2019/03/10"); reservation.Name = "Noah"; reservation.Site_Id = SiteId; int startingRowCount = GetRowCount("reservation"); int resID = dao.CreateReservation(reservation.Site_Id, reservation.Name, reservation.From_Date, reservation.To_Date, reservation.Create_date); int endingRowCount = GetRowCount("reservation"); Assert.AreEqual(resID, NewReservationId + 1); Assert.AreNotEqual(startingRowCount, endingRowCount); }
public void CreateReservationTest() { ReservationSqlDAO dao = new ReservationSqlDAO(connectionString); dao.CreateReservation(Convert.ToString(newSiteId), "John Family", "2020-02-19", "2020-02-21"); }