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();
 }
示例#2
0
        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);
        }