public void t_PointCountLess50_Delete() { Observation_ado setupObject = null; // backdoor data setup DbTestHelper.LoadAdoObjects(delegate(IbaUnitTestEntities iba) { setupObject = new Observation_ado() { Comments = "asdfasdf asdf adsfa dsfads fasdf adsfasd fadsf awefr34fr34r34 ", SpeciesId = new Guid(TestHelper.SPECIES_1_ID), EventId = TestHelper.TestGuid1, ObservationTypeId = _PointCountLess50TypeId }; iba.AddToObservation_ado(setupObject); }); List <Observation_ado> Observationlist = DbTestHelper.LoadExtraneousObservations(TestHelper.TestGuid3); ObservationMapper.Delete(new PointCountWithin50() { Id = setupObject.ObservationId }); // Validate results using (IbaUnitTestEntities iba = new IbaUnitTestEntities()) { var PointCountLess50Query = from PointCountLess50s in iba.Observation_ado select PointCountLess50s; Assert.IsNotNull(PointCountLess50Query, "Query result is null"); Assert.AreEqual(Observationlist.Count(), PointCountLess50Query.Count(), "Wrong number of results in query"); validateExtraObservations(Observationlist, PointCountLess50Query); } }
public void t_PointCountLess50_Select_ByGuid() { Observation_ado setupObject = null; // backdoor data setup Guid pointSurveyId = TestHelper.TestGuid3; DbTestHelper.LoadSinglePointSurvey(pointSurveyId, TestHelper.TestGuid2, TestHelper.TestGuid1, DateTime.Now, DateTime.Now.AddHours(1)); DbTestHelper.LoadAdoObjects(delegate(IbaUnitTestEntities iba) { setupObject = new Observation_ado() { Comments = "asdfasdf asdf adsfa dsfads fasdf adsfasd fadsf awefr34fr34r34 ", SpeciesId = new Guid(TestHelper.SPECIES_1_ID), EventId = pointSurveyId, ObservationTypeId = _PointCountLess50TypeId }; iba.AddToObservation_ado(setupObject); }); DbTestHelper.LoadExtraneousObservations(TestHelper.TestGuid3); // Exercise the test PointCountWithin50 PointCountLess50 = ObservationMapper.Select <PointCountWithin50>(setupObject.ObservationId); using (IbaUnitTestEntities iba = new IbaUnitTestEntities()) { validateObjectEquality(PointCountLess50, setupObject, iba); } }
public void t_PointCountLess50_Select_ByEventId() { Guid pointSurveyId = TestHelper.TestGuid2; DbTestHelper.LoadSinglePointSurvey(pointSurveyId, TestHelper.TestGuid2, TestHelper.TestGuid1, DateTime.Now, DateTime.Now.AddHours(1)); Observation_ado setupObject = null; // backdoor data setup DbTestHelper.LoadAdoObjects(delegate(IbaUnitTestEntities iba) { setupObject = new Observation_ado() { Comments = "asdfasdf asdf adsfa dsfads fasdf adsfasd fadsf awefr34fr34r34 ", SpeciesId = new Guid(TestHelper.SPECIES_1_ID), EventId = pointSurveyId, ObservationTypeId = _PointCountLess50TypeId }; iba.AddToObservation_ado(setupObject); }); DbTestHelper.LoadExtraneousObservations(TestHelper.TestGuid3); // Exercise the test List <PointCountWithin50> selectList = ObservationMapper.SelectAllForEvent <PointCountWithin50>(setupObject.EventId); Assert.AreEqual(1, selectList.Count(), "Does not contain just one object"); PointCountWithin50 result = selectList[0]; using (IbaUnitTestEntities iba = new IbaUnitTestEntities()) { validateObjectEquality(result, setupObject, iba); } }
public void t_PointCountLess50_Save_Update() { //loadSiteVisit(TestHelper.TestGuid1); Observation_ado setupObject = null; // backdoor data setup DbTestHelper.LoadAdoObjects(delegate(IbaUnitTestEntities iba) { setupObject = new Observation_ado() { Comments = "asdfasdf asdf adsfa dsfads fasdf adsfasd fadsf awefr34fr34r34 ", SpeciesId = new Guid(TestHelper.SPECIES_1_ID), EventId = TestHelper.TestGuid1, ObservationTypeId = _PointCountLess50TypeId }; iba.AddToObservation_ado(setupObject); }); List <Observation_ado> extraList = DbTestHelper.LoadExtraneousObservations(TestHelper.TestGuid3); // Setup object to be saved. Change everything except the Id. PointCountWithin50 testObject = new PointCountWithin50() { Comments = "hurdy gurdy", SpeciesCode = TestHelper.SPECIES_2_CODE, EventId = setupObject.EventId, Id = setupObject.ObservationId }; // Execute the test ObservationMapper.Update(testObject); // Validate results using (IbaUnitTestEntities iba = new IbaUnitTestEntities()) { var PointCountLess50Query = from PointCountLess50s in iba.Observation_ado select PointCountLess50s; Assert.IsNotNull(PointCountLess50Query, "Query result is null"); Assert.AreEqual(extraList.Count() + 1, PointCountLess50Query.Count(), "Wrong number of results in query"); Observation_ado adoPointCountLess50 = PointCountLess50Query.First(x => x.ObservationId == setupObject.ObservationId); validateObjectEquality(testObject, adoPointCountLess50, iba); validateExtraObservations(extraList, PointCountLess50Query); } }
public void t_PointCountLess50_Select_All() { // Backdoor setup Guid pointSurveyId = TestHelper.TestGuid3; DbTestHelper.LoadSinglePointSurvey(pointSurveyId, TestHelper.TestGuid2, TestHelper.TestGuid1, DateTime.Now, DateTime.Now.AddHours(1)); List <Observation_ado> list = DbTestHelper.LoadExtraneousObservations(pointSurveyId); List <Observation_ado> PointCountLess50AdoList = extraPointCountLess50s(list); // Exercise the test List <PointCountWithin50> PointCountLess50List = ObservationMapper.SelectAll <PointCountWithin50>(); // Validate results Assert.AreEqual(PointCountLess50AdoList.Count(), PointCountLess50List.Count, "Wrong number of objects in the result list"); foreach (Observation_ado ado in PointCountLess50AdoList) { // just check to make sure the object is there; leave specific value check for the Select_ByGuid test Assert.IsTrue(PointCountLess50List.Exists(x => x.Id.Equals(ado.ObservationId)), "Observation " + ado.ObservationId.ToString() + " is not in the results"); } }
public void t_BMDE_IncompleteSurvey() { DbTestHelper.LoadSinglePerson(PersonFirstName, PersonLastName, PersonGuid); List <Location_ado> locations = DbTestHelper.LoadExtraneousLocations(); DbTestHelper.LoadAdoObjects((IbaUnitTestEntities iba) => { DateTime startDateTimeme = DateTime.Now; SiteVisit_ado ado = SiteVisit_ado.CreateSiteVisit_ado(SiteVisitGuid, true, locations[0].LocationId, DateTime.Now.AddHours(-1), DateTime.Now, TestHelper.TestGuid1); ado.IsDataEntryComplete = false; // force incompletion iba.AddToSiteVisit_ado1(ado); }); Location_ado point = locations.First(x => x.ParentLocationId != null); DbTestHelper.LoadSinglePointSurvey(PointSurveyGuid, SiteVisitGuid, point.LocationId, DateTime.Now, DateTime.Now.AddHours(1)); DbTestHelper.LoadExtraneousObservations(PointSurveyGuid); string bmde = ResultsMapper.GetBMDE(); Assert.AreEqual(string.Empty, bmde); }