Exemple #1
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);
        }
Exemple #2
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);
        }