public void TestReservation() { var park = CreatePark("Mt. Airy"); park.Id = _db.AddPark(park); var alphaGnd = CreateCampground("Alpha", park.Id); alphaGnd.Id = _db.AddCampground(alphaGnd); var site1 = CreateSite(alphaGnd.Id, 1); site1.Id = _db.AddSite(site1); var site2 = CreateSite(alphaGnd.Id, 2, true); site2.Id = _db.AddSite(site2); var site3 = CreateSite(alphaGnd.Id, 3, true, true); site3.Id = _db.AddSite(site3); var site4 = CreateSite(alphaGnd.Id, 4, true, true, 24); site4.Id = _db.AddSite(site4); var site5 = CreateSite(alphaGnd.Id, 5, true, true, 24, 16); site5.Id = _db.AddSite(site5); // Test the default criteria var resInfo = CreateReservationInfo(alphaGnd.Id, DateTime.UtcNow.AddDays(1), DateTime.UtcNow.AddDays(2), false, false, 0, 1); var availableSites = _db.GetSites(resInfo); Assert.AreEqual(5, availableSites.Count); // Test the default criteria with utilities resInfo.HasUtilities = true; availableSites = _db.GetSites(resInfo); Assert.AreEqual(4, availableSites.Count); // Test the default criteria with utilities and accessibility resInfo.IsAccessible = true; availableSites = _db.GetSites(resInfo); Assert.AreEqual(3, availableSites.Count); // Test the default criteria with utilities, accessibility, and rv length resInfo.RvLength = 24; availableSites = _db.GetSites(resInfo); Assert.AreEqual(2, availableSites.Count); resInfo.RvLength = 25; availableSites = _db.GetSites(resInfo); Assert.AreEqual(0, availableSites.Count); // Test the default criteria with utilities, accessibility, max occupancy, and rv length resInfo.RvLength = 24; resInfo.Occupancy = 17; availableSites = _db.GetSites(resInfo); Assert.AreEqual(0, availableSites.Count); resInfo.Occupancy = 16; availableSites = _db.GetSites(resInfo); Assert.AreEqual(1, availableSites.Count); // Test date conflict User user = new User(); user.FirstName = "Chris"; user.LastName = "Rupp"; user.Email = "!@#$%^@tech.com"; user.Username = "******"; user.Password = "******"; user.ConfirmPassword = "******"; _userMgr.RegisterUser(user); var res1 = CreateReservation(site5, DateTime.UtcNow.AddDays(1), DateTime.UtcNow.AddDays(3)); _db.MakeReservation(res1, _userMgr.User.Id); availableSites = _db.GetSites(resInfo); Assert.AreEqual(0, availableSites.Count); }