public void TestParseMass() { var bioMassCalc = new BioMassCalc(MassType.Monoisotopic); string description = "C'2"; Assert.AreEqual(26, bioMassCalc.ParseMass(ref description), .01); Assert.AreEqual(string.Empty, description); description = "-C'2"; Assert.AreEqual(0, bioMassCalc.ParseMass(ref description)); Assert.AreEqual("-C'2", description); description = "C'2-C2"; Assert.AreEqual(26, bioMassCalc.ParseMass(ref description), .01); Assert.AreEqual("-C2", description); description = "C'2"; Assert.AreEqual(26, bioMassCalc.ParseMassExpression(ref description), .01); Assert.AreEqual(string.Empty, description); description = "C'2-C2"; Assert.AreEqual(2, bioMassCalc.ParseMassExpression(ref description), .01); Assert.AreEqual(string.Empty, description); description = "C'2-C2-N2"; Assert.AreEqual(2, bioMassCalc.ParseMassExpression(ref description), .01); Assert.AreEqual("-N2", description); Assert.AreEqual(2, bioMassCalc.CalculateMassFromFormula("C'2-C2"), .01); AssertEx.ThrowsException <ArgumentException>(() => bioMassCalc.CalculateMassFromFormula("C'2-C2-N2")); }