public void Carbon13Test() { IElementProvider provider = new MockElementProvider(); IElement c = provider.GetElement("C"); IElement c13 = provider.GetElement("C", 13); var formula = new ChemicalFormula(new[] { new EntityCardinality <IElement>(c, 1), new EntityCardinality <IElement>(c13, 1), }); var elements = formula.GetElements(); Assert.AreEqual(2, elements.Count); // Check masses Assert.AreEqual(c.Isotopes.FirstWithMax(x => x.RelativeAbundance).AtomicMass + c13.Isotopes.FirstWithMax(x => x.RelativeAbundance).AtomicMass, formula.GetMass(MassType.Monoisotopic)); Assert.AreEqual(c.Isotopes.Sum(x => x.AtomicMass * x.RelativeAbundance) + c13.Isotopes.Sum(x => x.AtomicMass * x.RelativeAbundance), formula.GetMass(MassType.Average)); Assert.AreEqual(c13.GetMass(MassType.Monoisotopic), c13.GetMass(MassType.Average)); }