public static void String_LessThanWorks(string a, string b) { IReadOnlyList <char> A = a.ToList(); IReadOnlyList <char> B = b.ToList(); LexicographicalComparer <char> comparer = new LexicographicalComparer <char>(new CharacterOrdinalIgnoreCase()); Assert.True(comparer.Compare(A, B) < 0); Assert.True(comparer.Compare(B, A) > 0); }
public static void CompareTest(IEnumerable <int> left, IEnumerable <int> right, int expected) { var comparer = new LexicographicalComparer <int>((x, y) => x.CompareTo(y)); var actual = comparer.Compare(left, right); Assert.Equal(expected, actual); }