public void UnorderableType2() { IComparer <Unorderable> ordering; Assert.Throws <InvalidOperationException>(() => ordering = Comparers.DefaultComparer <Unorderable>(), "Type \"Wintellect.PowerCollections.Tests.Unorderable\" does not implement IComparable<Wintellect.PowerCollections.Tests.Unorderable> or IComparable.", null); }
public void DefaultComparerGeneric() { IComparer <GOddEvenComparable> comparer = Comparers.DefaultComparer <GOddEvenComparable>(); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(7), new GOddEvenComparable(6)) < 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(7), new GOddEvenComparable(8)) < 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(12), new GOddEvenComparable(11)) > 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(12), new GOddEvenComparable(143)) > 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(5), new GOddEvenComparable(7)) < 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(9), new GOddEvenComparable(5)) > 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(6), new GOddEvenComparable(8)) < 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(14), new GOddEvenComparable(-8)) > 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(0), new GOddEvenComparable(0)) == 0); Assert.IsTrue(comparer.Compare(new GOddEvenComparable(-3), new GOddEvenComparable(-3)) == 0); }
public void UnorderableType2() { IComparer <Unorderable> ordering = Comparers.DefaultComparer <Unorderable>(); }