Exemplo n.º 1
0
        public void t_Delete()
        {
            Guid eventId = DbTestHelper.TestGuid1;
            Guid speciesId1 = new Guid(DbTestHelper.SPECIES_1_ID);
            Guid speciesId2 = new Guid(DbTestHelper.SPECIES_2_ID);
            string speciesCode2 = DbTestHelper.SPECIES_2_CODE;
            string comments1 = string.Empty;
            string comments2 = "comments 2";

            multiBackdoorSetup(eventId, speciesId1, speciesId2, comments1, comments2);

            // TODO: fix this
            FiftyMeterDataEntryMapper.Delete(new FiftyMeterDataEntry()
            {
                Comments = comments2,
                SpeciesCode = speciesCode2,
                PointSurveyId = eventId,
                CountBeyond50 = 2,
                CountWithin50 = 1
            }, new Business.Entities.FiftyMeterPointSurvey());

            // There should be one object left for species 1
            using (IbaUnitTestEntities iba = new IbaUnitTestEntities())
            {
                var observationQuery = from observations in iba.Observation_ado select observations;
                Assert.IsNotNull(observationQuery, "observationQuery is null");
                Assert.AreEqual(1, observationQuery.Count(), "observationQuery has wrong count");
                Assert.IsTrue(observationQuery.First().SpeciesId.Equals(speciesId1), "the remaining observation isn't for Species 1");
            }
        }
Exemplo n.º 2
0
        public void t_SelectAllForEvent_SiteVisit()
        {
            Guid siteVisitid = DbTestHelper.TestGuid3;
            DbTestHelper.LoadSingleSiteVisit(siteVisitid);
            Guid eventId = DbTestHelper.TestGuid1;
            Guid eventId2 = DbTestHelper.TestGuid2;
            Guid speciesId1 = new Guid(DbTestHelper.SPECIES_1_ID);
            Guid speciesId2 = new Guid(DbTestHelper.SPECIES_2_ID);
            string speciesCode1 = DbTestHelper.SPECIES_1_CODE;
            string speciesCode2 = DbTestHelper.SPECIES_2_CODE;
            string comments1 = string.Empty;
            string comments2 = "comments 2";

            DbTestHelper.LoadAdoObjects((IbaUnitTestEntities iba) =>
                {
                    PointSurvey_ado survey1 = PointSurvey_ado.CreatePointSurvey_ado(eventId, true, DbTestHelper.TestGuid2, DateTime.Now, DateTime.Now.AddHours(2));
                    survey1.SiteVisitId = siteVisitid;
                    iba.AddToPointSurvey_ado1(survey1);
                    PointSurvey_ado survey2 = PointSurvey_ado.CreatePointSurvey_ado(eventId2, true, DbTestHelper.TestGuid2, DateTime.Now, DateTime.Now.AddHours(2));
                    survey2.SiteVisitId = siteVisitid;
                    iba.AddToPointSurvey_ado1(survey2);
                });


            multiBackdoorSetup(eventId, speciesId1, speciesId2, comments1, comments2);
            multiBackdoorSetup(eventId2, speciesId1, speciesId2, comments1, comments2);


            // Run the system
            List<FiftyMeterDataEntry> entryList = FiftyMeterDataEntryMapper.SelectAllForEvent(siteVisitid);

            // Validate results
            Assert.IsNotNull(entryList, "entrylist is null");
            Assert.AreEqual(4, entryList.Count(), "entrylist does not contain 4 objects");

            // TODO: need to make sure the grouping handles different PointSurveyId values, separating them appropriately.

            ValidateFiftyMeterDataEntryObject(eventId, comments1, entryList, "1", 0, 1, speciesCode1);
            ValidateFiftyMeterDataEntryObject(eventId, comments2, entryList, "2", 2, 1, speciesCode2);
            ValidateFiftyMeterDataEntryObject(eventId2, comments1, entryList, "1", 0, 1, speciesCode1);
            ValidateFiftyMeterDataEntryObject(eventId2, comments2, entryList, "2", 2, 1, speciesCode2);
        }
Exemplo n.º 3
0
        public void t_SelectAllForEvent_Survey()
        {
            Guid eventId = DbTestHelper.TestGuid1;
            DbTestHelper.LoadSinglePointSurvey(eventId);
            Guid speciesId1 = new Guid(DbTestHelper.SPECIES_1_ID);
            Guid speciesId2 = new Guid(DbTestHelper.SPECIES_2_ID);
            string speciesCode1 = DbTestHelper.SPECIES_1_CODE;
            string speciesCode2 = DbTestHelper.SPECIES_2_CODE;
            string comments1 = string.Empty;
            string comments2 = "comments 2";

            multiBackdoorSetup(eventId, speciesId1, speciesId2, comments1, comments2);


            // Run the system
            List<FiftyMeterDataEntry> entryList = FiftyMeterDataEntryMapper.SelectAllForEvent(eventId);

            // Validate results
            Assert.IsNotNull(entryList, "entrylist is null");
            Assert.AreEqual(2, entryList.Count(), "entrylist does not contain 2 objects");

            ValidateFiftyMeterDataEntryObject(eventId, comments1, entryList, "1", 0, 1, speciesCode1);
            ValidateFiftyMeterDataEntryObject(eventId, comments2, entryList, "2", 2, 1, speciesCode2);
        }