public virtual void TestSort_Coefficients() { IChemObjectSet <T> set = (IChemObjectSet <T>)NewChemObject(); IChemObjectBuilder builder = set.Builder; T a = NewContainerObject(); T b = NewContainerObject(); a.Atoms.Add(builder.NewAtom("C")); a.Atoms.Add(builder.NewAtom("C")); b.Atoms.Add(builder.NewAtom("C")); set.Add(a, 1); set.Add(b, 2); Assert.AreEqual(a, set[0]); Assert.AreEqual(1D, set.GetMultiplier(0)); Assert.AreEqual(b, set[1]); Assert.AreEqual(2D, set.GetMultiplier(1)); // sort by atom container count var orderedSet = set.OrderBy(n => n, new ComparerByCoefficients()); AssertAreOrderLessEqual( new[] { a, b }.Cast <IChemObject>(), set.Cast <IChemObject>()); Assert.IsTrue(Compares.AreDeepEqual( new[] { 1D, 2D }, new[] { set.GetMultiplier(0), set.GetMultiplier(1) })); }