Example #1
0
        public void TestDefaultValidFalse()
        {
            IRule rule = new ToleranceRangeRule();

            var      formula = new MolecularFormula();
            IIsotope carb    = builder.NewIsotope("C");

            carb.ExactMass = 12.00;
            IIsotope cl = builder.NewIsotope("Cl");

            cl.ExactMass = 34.96885268;
            formula.Add(carb);
            formula.Add(cl);

            Assert.AreEqual(0.0, rule.Validate(formula), 0.0001);
        }
Example #2
0
        public void TestDefaultValidFalse_SetParam()
        {
            IRule rule = new ToleranceRangeRule();

            var      formula = new MolecularFormula();
            IIsotope carb    = builder.NewIsotope("C");

            carb.ExactMass = 12.00;
            IIsotope cl = builder.NewIsotope("Cl");

            cl.ExactMass = 34.96885268;
            formula.Add(carb);
            formula.Add(cl);

            object[] parameters = new object[2];
            parameters[0]   = 46.0; // real -> 46.96885268
            parameters[1]   = 0.00005;
            rule.Parameters = parameters;

            Assert.AreEqual(0.0, rule.Validate(formula), 0.0001);
        }