Пример #1
0
        public void TestGridSizeIllegalArguments()
        {
            GridSize grid;

            Assert.Throws <ArgumentException>(() => grid = new GridSize(0, 1));
            Assert.Throws <ArgumentException>(() => grid = new GridSize(1, 0));
            Assert.Throws <ArgumentException>(() => grid = new GridSize(-1, 1));
            Assert.Throws <ArgumentException>(() => grid = new GridSize(1, -1));

            grid = new GridSize(1, 1);

            Assert.Throws <ArgumentException>(() => grid.Columns = 0);
            Assert.Throws <ArgumentException>(() => grid.Rows    = 0);
            Assert.Throws <ArgumentException>(() => grid.Columns = -1);
            Assert.Throws <ArgumentException>(() => grid.Rows    = -1);

            Assert.Throws <ArgumentException>(() => grid.Set(0, 1));
            Assert.Throws <ArgumentException>(() => grid.Set(1, 0));
            Assert.Throws <ArgumentException>(() => grid.Set(-1, 1));
            Assert.Throws <ArgumentException>(() => grid.Set(1, -1));
        }
Пример #2
0
        public void TestGridSizeAssign()
        {
            GridSize grid = new GridSize(1, 1)
            {
                Rows    = 2,
                Columns = 3
            };

            Assert.AreEqual(grid.Rows, 2);
            Assert.AreEqual(grid.Columns, 3);

            grid.Set(4, 5);
            Assert.AreEqual(grid.Rows, 4);
            Assert.AreEqual(grid.Columns, 5);
        }