Ejemplo n.º 1
0
 public WebPeriodType GetPeriodType(Boolean refresh)
 {
     if (_periodType.IsNull() || refresh)
     {
         _periodType = PeriodManagerTest.GetOnePeriodType(GetContext());
     }
     return(_periodType);
 }
 public WebPeriod GetPeriod(Boolean refresh)
 {
     if (_period.IsNull() || refresh)
     {
         _period = PeriodManagerTest.GetOnePeriod(GetContext());
     }
     return(_period);
 }
 public void DeleteUserSelectedPeriods()
 {
     foreach (UserSelectedPeriodUsage periodUsage in Enum.GetValues(typeof(UserSelectedPeriodUsage)))
     {
         PeriodManager.AddUserSelectedPeriods(GetContext(), PeriodManagerTest.GetSomePeriodIds(GetContext()), periodUsage);
         PeriodManager.DeleteUserSelectedPeriods(GetContext());
     }
 }
        public void GetSpeciesFactsByUserParameterSelection()
        {
            List <Int32> factorIds, hostIds, individualCategoryIds,
                         periodIds, referenceIds, taxonIds;
            List <WebSpeciesFact>     speciesFacts;
            WebUserParameterSelection userParameterSelection;
            Int32 speciesFactCount;

            userParameterSelection = new WebUserParameterSelection();
            factorIds             = FactorManagerTest.GetSomeFactorIds();
            hostIds               = TaxonManagerTest.GetSomeTaxonIds();
            individualCategoryIds = IndividualCategoryManagerTest.GetSomeIndividualCategoryIds(GetContext());
            individualCategoryIds.RemoveAt(0);
            periodIds = PeriodManagerTest.GetSomePeriodIds(GetContext());
            periodIds.RemoveAt(periodIds.Count - 2);
            periodIds.RemoveAt(periodIds.Count - 2);
            referenceIds = ReferenceManagerTest.GetSomeReferenceIds(GetContext());
            taxonIds     = TaxonManagerTest.GetSomeTaxonIds();

            userParameterSelection.TaxonIds = taxonIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            Assert.IsTrue(speciesFacts.IsNotEmpty());
            speciesFactCount = speciesFacts.Count;

            userParameterSelection.FactorIds = factorIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            Assert.IsTrue(speciesFacts.IsNotEmpty());
            Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            userParameterSelection.FactorIds = null;

            userParameterSelection.IndividualCategoryIds = individualCategoryIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.IndividualCategoryIds = null;

            userParameterSelection.PeriodIds = periodIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.PeriodIds = null;

            userParameterSelection.HostIds = hostIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.HostIds = null;

            userParameterSelection.ReferenceIds = referenceIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.ReferenceIds = null;
        }