public void ReturnsMinimum() { using var strings = SampleData.Strings.AsTestingSequence(); var minima = MoreEnumerable.First(strings.MinBy(s => s.Length)); Assert.That(minima, Is.EqualTo("ax")); }
public void WithComparerReturnsMinimum() { using var strings = SampleData.Strings.AsTestingSequence(); var minima = strings.MinBy(s => s.Length, Comparable <int> .DescendingOrderComparer); Assert.That(MoreEnumerable.First(minima), Is.EqualTo("hello")); }
public void ReturnsMaximum() { using var strings = SampleData.Strings.AsTestingSequence(); var maxima = strings.MaxBy(s => s.Length); Assert.That(MoreEnumerable.First(maxima), Is.EqualTo("hello")); }
public void WithEmptySourceWithComparerThrows() { using var strings = Enumerable.Empty <string>().AsTestingSequence(); Assert.Throws <InvalidOperationException>(() => MoreEnumerable.First(strings.MinBy(s => s.Length, Comparable <int> .DescendingOrderComparer))); }
public void WithEmptySourceThrows() { using var strings = Enumerable.Empty <string>().AsTestingSequence(); Assert.Throws <InvalidOperationException>(() => MoreEnumerable.First(strings.MinBy(s => s.Length))); }