Beispiel #1
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion


        public WebFactorOrigin GetFactorOrigin()
        {
            if (_factorOrigin.IsNull())
            {
                _factorOrigin = FactorManagerTest.GetOneFactorOrigin(GetContext());
            }
            return(_factorOrigin);
        }
Beispiel #2
0
 private WebFactorUpdateMode GetFactorUpdateMode(Boolean refresh)
 {
     if (_factorUpdateMode.IsNull() || refresh)
     {
         _factorUpdateMode = FactorManagerTest.GetOneFactorUpdateMode(GetContext());
     }
     return(_factorUpdateMode);
 }
Beispiel #3
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        public WebFactorDataType GetFactorDataType()
        {
            if (_factorDataType.IsNull())
            {
                _factorDataType = FactorManagerTest.GetOneFactorDataType(GetContext());
            }
            return(_factorDataType);
        }
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        public WebFactorField GetFactorField()
        {
            if (_factorField.IsNull())
            {
                _factorField = FactorManagerTest.GetOneFactorField(GetContext());
            }
            return(_factorField);
        }
 public WebFactorTreeNode GetFactorTreeNode(Boolean refresh)
 {
     if (_factorTreeNode.IsNull() || refresh)
     {
         _factorTreeNode = FactorManagerTest.GetForestFactorTreeNode(GetContext());
     }
     return(_factorTreeNode);
 }
Beispiel #6
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        public WebFactorFieldEnumValue GetFactorFieldEnumValue()
        {
            if (_factorFieldEnumValue.IsNull())
            {
                _factorFieldEnumValue = FactorManagerTest.GetOneFactorFieldEnumValue(GetContext());
            }
            return(_factorFieldEnumValue);
        }
Beispiel #7
0
 public WebFactor GetFactor(Boolean refresh)
 {
     if (_factor.IsNull() || refresh)
     {
         _factor = FactorManagerTest.GetOneFactor(GetContext());
     }
     return(_factor);
 }
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        public WebFactorFieldEnum GetFactorFieldEnum()
        {
            if (_factorFieldEnum.IsNull())
            {
                _factorFieldEnum = FactorManagerTest.GetOneFactorFieldEnum(GetContext());
            }
            return(_factorFieldEnum);
        }
        public void GetTaxaByQuery()
        {
            Int32                   factorIndex;
            List <WebFactor>        factors;
            List <WebTaxon>         taxa;
            WebDataLogicCondition   dataLogicCondition;
            WebSpeciesFactCondition speciesFactCondition;

            // Test one condition and one factor.
            speciesFactCondition            = new WebSpeciesFactCondition();
            speciesFactCondition.Factors    = new WebFactor[1];
            speciesFactCondition.Factors[0] = FactorManagerTest.GetOneFactor(GetContext());
            taxa = TaxonManager.GetTaxaByQuery(GetContext(), GetDataQuery(speciesFactCondition), TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test one condition and several factors.
            speciesFactCondition = new WebSpeciesFactCondition();
            factors = FactorManagerTest.GetSomeFactors(GetContext());
            speciesFactCondition.Factors = new WebFactor[factors.Count];
            for (factorIndex = 0; factorIndex < speciesFactCondition.Factors.Length; factorIndex++)
            {
                speciesFactCondition.Factors[factorIndex] = factors[factorIndex];
            }
            taxa = TaxonManager.GetTaxaByQuery(GetContext(), GetDataQuery(speciesFactCondition), TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test several conditions and one factor.
            dataLogicCondition             = new WebDataLogicCondition();
            dataLogicCondition.DataQueries = new List <WebDataQuery>();
            dataLogicCondition.Operator    = DataLogicConditionOperatorId.And;
            factors = FactorManagerTest.GetSomeFactors(GetContext());
            for (factorIndex = 0; factorIndex < factors.Count; factorIndex++)
            {
                speciesFactCondition            = new WebSpeciesFactCondition();
                speciesFactCondition.Factors    = new WebFactor[1];
                speciesFactCondition.Factors[0] = factors[factorIndex];
                dataLogicCondition.DataQueries.Add(GetDataQuery(speciesFactCondition));
            }
            taxa = TaxonManager.GetTaxaByQuery(GetContext(), GetDataQuery(dataLogicCondition), TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test several conditions and several factors.
            dataLogicCondition             = new WebDataLogicCondition();
            dataLogicCondition.DataQueries = new List <WebDataQuery>();
            dataLogicCondition.Operator    = DataLogicConditionOperatorId.And;
            factors = FactorManagerTest.GetSomeFactors(GetContext());
            for (factorIndex = 0; factorIndex < factors.Count; factorIndex++)
            {
                speciesFactCondition            = new WebSpeciesFactCondition();
                speciesFactCondition.Factors    = new WebFactor[2];
                speciesFactCondition.Factors[0] = factors[factorIndex++];
                speciesFactCondition.Factors[1] = factors[factorIndex];
                dataLogicCondition.DataQueries.Add(GetDataQuery(speciesFactCondition));
            }
            taxa = TaxonManager.GetTaxaByQuery(GetContext(), GetDataQuery(dataLogicCondition), TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());
        }
        public void Factor()
        {
            WebFactor factor;

            factor = null;
            GetFactorTreeNode(true).Factor = factor;
            Assert.IsNull(GetFactorTreeNode().Factor);

            factor = FactorManagerTest.GetForestFactor(GetContext());
            GetFactorTreeNode().Factor = factor;
            Assert.IsNotNull(GetFactorTreeNode().Factor);
            Assert.AreEqual(GetFactorTreeNode().Factor, factor);
        }
        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;
        }