Ejemplo n.º 1
0
        public void GetCampgroundsAtPark_InsertedCampgroundExists()
        {
            using (TransactionScope transaction = new TransactionScope())
            {
                CampgroundSqlDAL testClass = new CampgroundSqlDAL(connectionString);

                Park tempPark = new Park();
                tempPark.Area           = 0;
                tempPark.Description    = "TEST DESCRIPTION";
                tempPark.Establish_Date = new DateTime(2000, 1, 1).Date;
                tempPark.Location       = "TEST LOCATION";
                tempPark.Name           = "TEST PARK";
                tempPark.Visitors       = 0;
                int tempPark_parkId = ParkSqlDALTests.InsertFakePark(tempPark);

                Campground testCamp = new Campground();
                testCamp.Daily_Fee     = 5.00M;
                testCamp.Name          = "Slimy Valley";
                testCamp.Open_From_MM  = 5;
                testCamp.Open_To_MM    = 6;
                testCamp.Park_Id       = tempPark_parkId;
                testCamp.Campground_Id = InsertFakeCampground(testCamp);

                Campground insertedCampground = testClass.GetCampgroundsAtPark(tempPark_parkId).First();

                Assert.IsNotNull(insertedCampground);
            }
        }
        private void ManualInitialize()
        {
            // Put a temporary park into the database
            tempPark.Area           = 0;
            tempPark.Description    = "TEST DESCRIPTION";
            tempPark.Establish_Date = new DateTime(2000, 1, 1).Date;
            tempPark.Location       = "TEST LOCATION";
            tempPark.Name           = "TEST PARK";
            tempPark.Visitors       = 0;
            int tempPark_parkId = ParkSqlDALTests.InsertFakePark(tempPark);

            // Put a temporary campground into the database
            // Record the id into a class scope int variable
            testCamp.Daily_Fee    = 5.00M;
            testCamp.Name         = "Slimy Valley";
            testCamp.Open_From_MM = 1;
            testCamp.Open_To_MM   = 12;
            testCamp.Park_Id      = tempPark_parkId;

            // put a temporary site into the database
            // Record the id into a class scope int variable
            testCamp.Campground_Id = CampgroundSqlDALTests.InsertFakeCampground(testCamp);
            testSite.Campground_Id = testCamp.Campground_Id;
            testSite.Site_Number   = 1;
            siteId = SiteSqlDALTests.InsertFakeSite(testSite);
        }
Ejemplo n.º 3
0
 public void GetParkByParkName()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int        newParkId = ParkSqlDALTests.InsertFakePark(park);
         ParkSqlDAL testClass = new ParkSqlDAL(connectionString);
         ParkModel  newPark   = testClass.GetParkByParkName(park.Name);
         Assert.AreEqual(newPark.ParkId, newParkId);
     }
 }
Ejemplo n.º 4
0
 public void GetAllParks()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int              newParkId = ParkSqlDALTests.InsertFakePark(park);
         ParkSqlDAL       testClass = new ParkSqlDAL(connectionString);
         List <ParkModel> parks     = testClass.GetAllParks();
         Assert.IsTrue(parks.Select(park => park.ParkId).Contains(newParkId));
     }
 }
Ejemplo n.º 5
0
 public void GetTrailsByParkName()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int               newParkId  = ParkSqlDALTests.InsertFakePark(park);
         int               newTrailId = TrailSqlDALTests.InsertFakeTrail(trail, newParkId);
         TrailSqlDAL       testClass  = new TrailSqlDAL(connectionString);
         List <TrailModel> newTrails  = testClass.GetTrailsByParkName(park.Name);
         Assert.IsTrue(newTrails.Select(trail => trail.TrailId).Contains(newTrailId));
     }
 }
Ejemplo n.º 6
0
 public void GetTrailByTrailName()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int         newParkId  = ParkSqlDALTests.InsertFakePark(park);
         int         newTrailId = TrailSqlDALTests.InsertFakeTrail(trail, newParkId);
         TrailSqlDAL testClass  = new TrailSqlDAL(connectionString);
         TrailModel  newTrail   = testClass.GetTrailByTrailName(trail.Name);
         Assert.AreEqual(newTrail.TrailId, newTrailId);
     }
 }
Ejemplo n.º 7
0
 public void GetImageByParkId()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int        newParkId           = ParkSqlDALTests.InsertFakePark(park);
         int        newParkImageId      = ParkSqlDALTests.InsertFakeParkImage(parkImage, newParkId);
         ParkSqlDAL testClass           = new ParkSqlDAL(connectionString);
         string     newParkImageAddress = testClass.GetImageByParkId(newParkId);
         Assert.AreEqual(parkImage.ImageAddress, newParkImageAddress);
     }
 }
 public void GetPanoramicById()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int             newParkId          = ParkSqlDALTests.InsertFakePark(park);
         int             newTrailId         = TrailSqlDALTests.InsertFakeTrail(trail, newParkId);
         int             newPanoramicId     = PanoramicSqlDALTests.InsertFakePanoramic(panoramicImage, newTrailId);
         PanoramicSqlDAL testClass          = new PanoramicSqlDAL(connectionString);
         PanoramicModel  newPanoramicImages = testClass.GetPanoramicById(newPanoramicId);
         Assert.AreEqual(newPanoramicImages.PanoramicId, newPanoramicId);
     }
 }
 public void GetAllPanoramics()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int                   newParkId          = ParkSqlDALTests.InsertFakePark(park);
         int                   newTrailId         = TrailSqlDALTests.InsertFakeTrail(trail, newParkId);
         int                   newPanoramicId     = PanoramicSqlDALTests.InsertFakePanoramic(panoramicImage, newTrailId);
         PanoramicSqlDAL       testClass          = new PanoramicSqlDAL(connectionString);
         List <PanoramicModel> newPanoramicImages = testClass.GetAllPanoramics();
         Assert.IsTrue(newPanoramicImages.Select(panoramic => panoramic.PanoramicId).Contains(newPanoramicId));
     }
 }