Пример #1
0
        public void Multi()
        {
            var dbSmall = new FakeDbReader <int>(1, 2, 3, 4);
            var take    = dbSmall.Take(2);

            Assert.Equal(new[] { 1, 2 }, take.ToImmutableArray());
            Assert.Equal(new[] { 1, 2 }, take.ToImmutableArray());
        }
Пример #2
0
        public void Take()
        {
            var dbSmall = new FakeDbReader <int>(1, 2, 3, 4);

            Assert.Empty(dbSmall.Take(0).ToImmutableArray());
            Assert.Equal(new [] { 1, 2, 3 }, dbSmall.Take(3).ToImmutableArray());
            Assert.Equal(new [] { 1, 2, 3, 4 }, dbSmall.Take(4).ToImmutableArray());
            Assert.Equal(new [] { 1, 2, 3, 4 }, dbSmall.Take(5).ToImmutableArray());
            var largeRange = Enumerable.Range(1, 10_000);
            var dbLarge    = new FakeDbReader <int>(largeRange);

            Assert.Empty(dbLarge.Take(0).ToImmutableArray());
            Assert.Equal(largeRange.Take(9), dbLarge.Take(9).ToImmutableArray());
            Assert.Equal(largeRange.Take(99), dbLarge.Take(99).ToImmutableArray());
            Assert.Equal(largeRange.Take(999), dbLarge.Take(999).ToImmutableArray());
            Assert.Equal(largeRange.Take(9999), dbLarge.Take(9999).ToImmutableArray());
            Assert.Equal(largeRange.Take(99999), dbLarge.Take(99999).ToImmutableArray());
        }