public void AtOrDefault_FromEnumerableExtensions_ReturnsCorrectValues(int index, int length)
        {
            var source = Enumerable.Range(0, length);
            var sut    = EnumerableExtensions.AtOrDefault(source, index);

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

            Assert.Equal(index, sut);
        }
        public void AtOrDefault_FromEnumerableExtensions_GivenIndexOurOfRange_ReturnsNull_WhenExecutedOnReferenceCollection(int index, int collectionLength)
        {
            var source = Enumerable.Range(0, collectionLength).Select(x => x.ToString());

            Assert.Equal(null, EnumerableExtensions.AtOrDefault(source, index));
        }
        public void AtOrDefault_FromEnumerableExtensions_GivenIndexOurOfRange_ReturnsDefaultValue_WhenExecutedOnValueCollection(int index, int length)
        {
            var source = Enumerable.Range(0, length);

            Assert.Equal(default(int), EnumerableExtensions.AtOrDefault(source, index));
        }
 public void AtOrDefault_FromEnumerableExtensions_GivenNullSource_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => EnumerableExtensions.AtOrDefault <int>(null, 0));
 }