예제 #1
0
 public void RangeToReturnsEnumerableStartingFromStartArgumentAndEndingAtTheEndArgument()
 {
     EnumerableSupport.RangeTo(7, 18)
     .Should()
     .BeEquivalentTo(new[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 })
     .And.BeInAscendingOrder();
 }
예제 #2
0
        public void RangeToThrowsArgumentExceptionWhenStartArgumentIsGreaterThanTheEndArgument()
        {
            Action rangeTo = () => EnumerableSupport.RangeTo(1, 0).GetEnumerator().MoveNext();

            rangeTo.Should()
            .Throw <ArgumentsException>()
            .WithMessage("Start is greater than end. (Parameters 'start', 'end')");
        }
예제 #3
0
 public static IEnumerable <int> RangeFrom(this int end, int start) => EnumerableSupport.RangeTo(start, end);
예제 #4
0
 public static IEnumerable <int> ToEnumerable(this in Range range) =>
 EnumerableSupport.RangeTo(range.Start.Value, range.End.Value);