public void FromComparison_Returns_A_Comparer_Based_On_A_Comparison() { var a = new Foo("foo"); var b = new Foo("bar"); var comparer = XComparer <Foo> .FromComparison((x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal)); comparer.Compare(a, b).Should().BeGreaterThan(0); }
/// <summary> /// Creates a comparer that uses the specified <see cref="Comparison{T}"/> delegate to compare objects. /// </summary> /// <param name="comparison">The <see cref="Comparison{T}"/> delegate used to compare objects.</param> /// <returns>A comparer that uses the specified <see cref="Comparison{T}"/> delegate to compare objects.</returns> public static IComparer <T> FromComparison([NotNull] Comparison <T> comparison) { return(XComparer.FromComparison(comparison)); }