CanIncrement() public method

public CanIncrement ( ) : bool
return bool
        public void EmptyArray()
        {
            var idx = new ArrayIndex(new int[] { });
            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0 }));

            Assert.IsFalse(idx.CanIncrement());
            Assert.Throws<IndexOutOfRangeException>(() => { idx.Increment(); });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0 }));
        }
Beispiel #2
0
        public void EmptyArray()
        {
            var idx = new ArrayIndex(new int[] { });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0 }));

            Assert.IsFalse(idx.CanIncrement());
            Assert.Throws <IndexOutOfRangeException>(() => { idx.Increment(); });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0 }));
        }
        public void RankedArray()
        {
            var idx = new ArrayIndex(new int[,] { { 1, 1 }, { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 } });
            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0, 0 }));

            Assert.IsTrue(idx.CanIncrement());
            idx.Increment();

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0, 1 }));

            idx.Increment();
            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1, 0 }));

            idx.Increment();
            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1, 1 }));

            Assert.Throws<IndexOutOfRangeException>(() => { idx.Increment(10); });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1, 1 }));
        }
        public void SimpleArray()
        {
            var idx = new ArrayIndex(new int[] { 1, 2, 3, 4, 5 });
            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0 }));

            Assert.IsTrue(idx.CanIncrement());
            idx.Increment();

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1 }));

            idx.Increment();
            idx.Increment();

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 3 }));

            idx.Increment();
            Assert.Throws<IndexOutOfRangeException>(() => { idx.Increment(); });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 4 }));
        }
Beispiel #5
0
        public void SimpleArray()
        {
            var idx = new ArrayIndex(new int[] { 1, 2, 3, 4, 5 });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0 }));

            Assert.IsTrue(idx.CanIncrement());
            idx.Increment();

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1 }));

            idx.Increment();
            idx.Increment();

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 3 }));

            idx.Increment();
            Assert.Throws <IndexOutOfRangeException>(() => { idx.Increment(); });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 4 }));
        }
Beispiel #6
0
        public void RankedArray()
        {
            var idx = new ArrayIndex(new int[, ] {
                { 1, 1 }, { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }
            });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0, 0 }));

            Assert.IsTrue(idx.CanIncrement());
            idx.Increment();

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 0, 1 }));

            idx.Increment();
            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1, 0 }));

            idx.Increment();
            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1, 1 }));

            Assert.Throws <IndexOutOfRangeException>(() => { idx.Increment(10); });

            Assert.IsTrue(idx.Index.SequenceEqual(new int[] { 1, 1 }));
        }