Пример #1
0
        public void At_FromEnumerableExtensions_ReturnsCorrectValues(int index, int length)
        {
            var source = Enumerable.Range(0, length);
            var sut    = EnumerableExtensions.At(source, index);

            if (index < 0)
            {
                index = length + index;
            }

            Assert.Equal(index, sut);
        }
Пример #2
0
        public void At_FromEnumerableExtensions_GivenIndexOurOfRange_ThrowsIndexOurOfRangeException(int index, int length)
        {
            var source = Enumerable.Range(0, length);

            Assert.Throws <IndexOutOfRangeException>(() => EnumerableExtensions.At(source, index));
        }
Пример #3
0
 public void At_FromEnumerableExtensions_GivenNullSource_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => EnumerableExtensions.At <int>(null, 0));
 }