System.Linq.Tests.SelectTests.Select_SourceIsIList_ElementAt C# (CSharp) Méthode

Select_SourceIsIList_ElementAt() private méthode

private Select_SourceIsIList_ElementAt ( ) : void
Résultat void
        public void Select_SourceIsIList_ElementAt()
        {
            var source = new List<int> { 1, 2, 3, 4 }.AsReadOnly().Select(i => i * 2);
            for (int i = 0; i != 4; ++i)
                Assert.Equal(i * 2 + 2, source.ElementAt(i));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => source.ElementAt(-1));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => source.ElementAt(4));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => source.ElementAt(40));

            Assert.Equal(6, source.Skip(1).ElementAt(1));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => source.Skip(2).ElementAt(9));
        }
SelectTests