Exemple #1
0
        public void WidthAndHeightIsSetCorrectly()
        {
            int          width  = 2;
            int          height = 3;
            IField <int> field  = new TestIntField(height, width);

            Assert.AreEqual(field.Height, height);
            Assert.AreEqual(field.Width, width);
        }
Exemple #2
0
        public void FieldFilledFrom1to6()
        {
            /*
             * (0,0) -> [1] [2]
             *        [3] [4]
             *        [5] [6]
             */

            IField <int> field = new TestIntField(3, 2);

            for (int x = 0; x < field.Height; x++)
            {
                for (int y = 0; y < field.Width; y++)
                {
                    field[x, y] = (x * field.Width + y) + 1;
                }
            }

            Assert.AreEqual(field[0, 0], 1);
            Assert.AreEqual(field[2, 1], 6);
        }