예제 #1
0
        public void TestCreateSectionWithSufficientDatas()
        {
            var source = Enumerable.Range(0, 100).ToArray();
            var from   = 0;
            var size   = 10;

            var expected = size;
            int actual;

            var section = new PartitionSection <int>(source, from, size);

            actual = section.Count();
            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void TestEnumerateWithInsufficientDatas2()
        {
            var source = Enumerable.Range(0, 100).ToArray();
            var from   = 95;
            var size   = 10;

            var expected = source.Length - from;
            int actual;

            var section = new PartitionSection <int>(source, from, size);

            actual = section.Count();
            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void TestGenericEnumerator()
        {
            var source = Enumerable.Range(0, 100).ToArray();
            var from   = 0;
            var size   = 10;

            var expected = size;
            var actual   = 0;

            var section = new PartitionSection <int>(source, from, size);

            var enumerator = section.GetEnumerator();

            while (enumerator.MoveNext())
            {
                actual++;
            }
            Assert.Equal(expected, actual);
        }