示例#1
0
        public void GetRowIndexTest()
        {
            BaseGrid target = new BaseGrid();

            target.XOrigin         = 0;
            target.YOrigin         = 0;
            target.NumberOfColumns = 10;
            target.NumberOfRows    = 10;
            target.GridSize        = 10;

            Assert.AreEqual(0, target.GetColumnIndex(1));
            Assert.AreEqual(0, target.GetColumnIndex(10));
            Assert.AreEqual(1, target.GetColumnIndex(11));

            Assert.AreEqual(0, target.GetRowIndex(4));
            Assert.AreEqual(0, target.GetRowIndex(10));
            Assert.AreEqual(5, target.GetRowIndex(55));
            Assert.AreEqual(9, target.GetRowIndex(100));
        }