public override void Setup() { base.Setup(); mocks = new MockRepository(); // save one entry in the database that has a place and a watershed attached ClosestWatershedToPlace closestWatershedToPlace = new ClosestWatershedToPlace(); Place testPlace = new Place(); testPlace.CgndbKey = "ABCDE"; testPlace.CreateAndFlush(); Watershed testWatershed = new Watershed(); testWatershed.DrainageCode = "01-00-00-00-00-00"; testWatershed.Place = testPlace; testWatershed.CreateAndFlush(); closestWatershedToPlace.Place = testPlace; closestWatershedToPlace.Watershed = testWatershed; closestWatershedToPlace.CreateAndFlush(); }
public void TestBelongsToPlace() { string drainageCode = "01-02-03-04-05-06"; string cgndbKey = "ABCDE"; Place place = new Place(); place.CgndbKey = cgndbKey; place.CreateAndFlush(); Watershed watershed = new Watershed(); watershed.DrainageCode = drainageCode; watershed.Place = place; watershed.CreateAndFlush(); Watershed dbWatershed = Watershed.Find(drainageCode); Assert.IsNotNull(dbWatershed); Assert.IsNotNull(dbWatershed.Place); Assert.AreEqual(cgndbKey, dbWatershed.Place.CgndbKey); }
public void TestAltPlace() { int id = 37; string cgndbKey = "ABCDE"; Place place = new Place(); place.CgndbKey = cgndbKey; place.CreateAndFlush(); WaterBody waterbody = new WaterBody(); waterbody.Id = id; waterbody.AltPlace = place; waterbody.CreateAndFlush(); WaterBody dbWaterbody = WaterBody.Find(id); Assert.IsNotNull(dbWaterbody); Assert.IsNotNull(dbWaterbody.AltPlace); Assert.AreEqual(cgndbKey, dbWaterbody.AltPlace.CgndbKey); }
public void TestClosestWatershedToPlace() { string cgndbKey = "ABCDE"; Place place = new Place(); place.CgndbKey = cgndbKey; place.CreateAndFlush(); Watershed watershed = new Watershed(); watershed.DrainageCode = "01-02-03-04-05-06"; watershed.Place = place; watershed.CreateAndFlush(); ClosestWatershedToPlace closestWatershedToPlace = new ClosestWatershedToPlace(); closestWatershedToPlace.Place = place; closestWatershedToPlace.Watershed = watershed; closestWatershedToPlace.CreateAndFlush(); Place dbPlace = Place.Find(cgndbKey); Assert.IsNotNull(dbPlace); Assert.AreEqual(closestWatershedToPlace, place.ClosestWatershedToPlace); }
public void TestRelatedInteractiveMapsNeverReturnsNull() { Assert.Ignore(); Place place = new Place(); place.CgndbKey = "ABCDE"; place.CreateAndFlush(); IList<InteractiveMap> interativeMaps = place.RelatedInteractiveMaps; Assert.IsNotNull(interativeMaps); Assert.AreEqual(0, interativeMaps.Count); }