public void Initialize() { transactionScope = new TransactionScope(); site = new Site { CampgroundId = 13, SiteNumber = 10, MaxOccupancy = 6, IsAccessible = true, MaxRVLength = 30, UtilitiesAreAvail = true }; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand cmd; cmd = new SqlCommand("insert into site (campground_id, site_number, max_occupancy, accessible, max_rv_length, utilities) values (13, 10, 6, 1, 30, 1);", connection); cmd.ExecuteNonQuery(); cmd = new SqlCommand("select @@identity", connection); siteId1 = Convert.ToInt32(cmd.ExecuteScalar()); cmd = new SqlCommand("insert into site(campground_id, site_number, max_occupancy, accessible, max_rv_length, utilities) values(7, 14, 6, 0, 25, 0);", connection); cmd.ExecuteNonQuery(); cmd = new SqlCommand("select @@identity", connection); siteId2 = Convert.ToInt32(cmd.ExecuteScalar()); cmd = new SqlCommand("insert into site(campground_id, site_number, max_occupancy, accessible, max_rv_length, utilities) values(7, 15, 8, 1, 20, 1);", connection); cmd.ExecuteNonQuery(); cmd = new SqlCommand("select @@identity", connection); siteId3 = Convert.ToInt32(cmd.ExecuteScalar()); cmd = new SqlCommand("insert into site(campground_id, site_number, max_occupancy, accessible, max_rv_length, utilities) values(7, 16, 4, 0, 0, 0);", connection); cmd.ExecuteNonQuery(); cmd = new SqlCommand("select @@identity", connection); siteId4 = Convert.ToInt32(cmd.ExecuteScalar()); cmd = new SqlCommand("insert into site(campground_id, site_number, max_occupancy, accessible, max_rv_length, utilities) values(7, 17, 20, 1, 50, 1);", connection); cmd.ExecuteNonQuery(); cmd = new SqlCommand("select @@identity", connection); siteId5 = Convert.ToInt32(cmd.ExecuteScalar()); reserve3 = new ReservationsSqlDAL(connectionString); reserve3.CreateReservation(siteId5, "testers", arrival, departure); } }
public void CreateReservationTest() { //Arrange ReservationsSqlDAL reserveDal = new ReservationsSqlDAL(connectionString); string name2 = "testers2"; int reserveId; // Act reserveId = reserveDal.CreateReservation(siteId6, name2, arrival, departure); //Assert Assert.IsNotNull(reserveId); }