Пример #1
0
        public void TestDefault()
        {
            IRule rule    = new ToleranceRangeRule();
            var   objects = rule.Parameters;

            Assert.AreEqual(2, objects.Count);

            double mass = (double)objects[0];

            Assert.AreEqual(0.0, mass, 0.00001);
            double tolerance = (double)objects[1];

            Assert.AreEqual(0.05, tolerance, 0.00001);
        }
Пример #2
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);
        }
Пример #3
0
        public void TestSetParameters()
        {
            IRule rule = new ToleranceRangeRule();

            object[] parameters = new object[2];
            parameters[0]   = 133.0;
            parameters[1]   = 0.00005;
            rule.Parameters = parameters;

            var objects = rule.Parameters;

            Assert.AreEqual(2, objects.Count);

            double mass = (double)objects[0];

            Assert.AreEqual(133.0, mass, 0.00001);
            double tolerance = (double)objects[1];

            Assert.AreEqual(0.00005, tolerance, 0.00001);
        }
Пример #4
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);
        }
Пример #5
0
        public void TestToleranceRangeRule()
        {
            IRule rule = new ToleranceRangeRule();

            Assert.IsNotNull(rule);
        }