public void RangeToReturnsEnumerableStartingFromStartArgumentAndEndingAtTheEndArgument() { EnumerableSupport.RangeTo(7, 18) .Should() .BeEquivalentTo(new[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }) .And.BeInAscendingOrder(); }
public void RangeToThrowsArgumentExceptionWhenStartArgumentIsGreaterThanTheEndArgument() { Action rangeTo = () => EnumerableSupport.RangeTo(1, 0).GetEnumerator().MoveNext(); rangeTo.Should() .Throw <ArgumentsException>() .WithMessage("Start is greater than end. (Parameters 'start', 'end')"); }
public static IEnumerable <int> RangeFrom(this int end, int start) => EnumerableSupport.RangeTo(start, end);
public static IEnumerable <int> ToEnumerable(this in Range range) => EnumerableSupport.RangeTo(range.Start.Value, range.End.Value);