Ejemplo n.º 1
0
        public void TestDefault()
        {
            IRule rule    = new ChargeRule();
            var   objects = rule.Parameters;

            Assert.AreEqual(1, objects.Count);

            double charge = (double)objects[0];

            Assert.AreEqual(0.0, charge, 0.00001);
        }
Ejemplo n.º 2
0
        public void TestDefaultValidTrue()
        {
            IRule rule = new ChargeRule();

            var formula = new MolecularFormula();

            formula.Add(builder.NewIsotope("C"), 2);
            formula.Add(builder.NewIsotope("H"), 6);
            formula.Charge = 0;

            Assert.AreEqual(1.0, rule.Validate(formula), 0.0001);
        }
Ejemplo n.º 3
0
        public void TestDefaultValidFalseSetParam()
        {
            IRule rule    = new ChargeRule();
            var   formula = new MolecularFormula();

            formula.Add(builder.NewIsotope("C"), 2);
            formula.Add(builder.NewIsotope("H"), 200);
            formula.Charge  = 1;
            rule.Parameters = new object[] { -1.0 };

            Assert.AreEqual(0.0, rule.Validate(formula), 0.0001);
        }
Ejemplo n.º 4
0
        public void TestSetParameters()
        {
            IRule rule = new ChargeRule {
                Parameters = new object[] { -1.0 }
            };

            var objects = rule.Parameters;

            Assert.AreEqual(1, objects.Count);

            double charge = (double)objects[0];

            Assert.AreEqual(-1.0, charge, 0.00001);
        }
Ejemplo n.º 5
0
        public void TestChargeRule()
        {
            IRule rule = new ChargeRule();

            Assert.IsNotNull(rule);
        }