コード例 #1
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);
     }
 }
コード例 #2
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));
     }
 }
コード例 #3
0
 public void GetImagesByTrailId()
 {
     using (TransactionScope transaction = new TransactionScope())
     {
         int         newParkId            = ParkSqlDALTests.InsertFakePark(park);
         int         newTrailId           = TrailSqlDALTests.InsertFakeTrail(trail, newParkId);
         int         newTrailImageId      = TrailSqlDALTests.InsertFakeTrailImage(trailImage, newTrailId);
         TrailSqlDAL testClass            = new TrailSqlDAL(connectionString);
         string      newTrailImageAddress = testClass.GetImageByTrailId(newTrailId);
         Assert.AreEqual(trailImage.ImageAddress, newTrailImageAddress);
     }
 }