Пример #1
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);
        }
Пример #2
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);
        }