Exemplo n.º 1
0
        // ReSharper restore StringLiteralTypo
        public void TestComputeEmpiricalFormulaMassMethod1(string strEmpiricalFormula, double expectedMass)
        {
            var empiricalFormula = PeptideMassCalculator.GetEmpiricalFormulaComponents(strEmpiricalFormula);
            var computedMass     = PeptideMassCalculator.ComputeMonoisotopicMass(empiricalFormula);

            var computedMassAlt = PeptideMassCalculator.ComputeMonoisotopicMass(empiricalFormula.ElementCounts, out _);

            Console.WriteLine("{0,-30} is {1:F5}; expected {2:F5}", strEmpiricalFormula, computedMass, expectedMass);

            Assert.AreEqual(computedMass, computedMassAlt, 1E-05, "The two overloads for ComputeMonoisotopicMass reported conflicting mass values");

            Assert.AreEqual(expectedMass, computedMass, 0.0001, "Unexpected mass for the empirical formula");
        }