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); } }
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)); } }
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); } }