示例#1
0
 public void TestNullParameterReturnsNull()
 {
     Map testMap = new Map(10, 10);
     testMap.InitializeGrid();
     MapTile[,] extract = testMap.GetSubset(null, 3, 3);
     Assert.IsNull(extract);
 }
示例#2
0
 public void TestGetMapExtractNotNull()
 {
     Map testMap = new Map(10, 10);
     testMap.InitializeGrid();
     Coordinates coord = new Coordinates();
     coord.SetCoordinates(1,1);
     Assert.IsNotNull(testMap.GetSubset(coord, 5, 5));
 }
示例#3
0
 public void TestEvenParameterWidthReturnsNull()
 {
     Map testMap = new Map(10, 10);
     testMap.InitializeGrid();
     Coordinates coord = new Coordinates();
     coord.SetCoordinates(1, 1);
     MapTile[,] extract = testMap.GetSubset(coord, 2, 3);
     Assert.IsNull(extract);
 }
示例#4
0
 public void TestGetMapExtractColumnsNumberOk()
 {
     Map testMap = new Map(10, 10);
     testMap.InitializeGrid();
     Coordinates coord = new Coordinates();
     coord.SetCoordinates(1, 1);
     MapTile[,] extract = testMap.GetSubset(coord, 3, 3);
     Assert.IsTrue(extract.GetLength(0) == 3);
 }
示例#5
0
        public void TestNegativeParameterHeightReturnsNull()
        {
            Map testMap = new Map(10, 10);
            testMap.InitializeGrid();

            Coordinates coord = new Coordinates();
            coord.SetCoordinates(1, 1);

            MapTile[,] extract = testMap.GetSubset(coord, 3, -1);
            Assert.IsNull(extract);
        }
示例#6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="coordinates"></param>
        public SurroundingView(ICoordinates coordinates, MapTile[,] view)
        {
            // Set the center coordinate
            CellPositionInWorld = coordinates;
            
            viewSizeX = Convert.ToInt16(view.GetUpperBound(0));
            viewSizeY = Convert.ToInt16(view.GetUpperBound(1));

            CellPositionInView = new Coordinates((Int16)(viewSizeX / 2), (Int16)(viewSizeY / 2));

            View = new Map(viewSizeX, viewSizeY);
            View.InitializeGrid(view);
        }
示例#7
0
        public void TestGetMapExtractOutterBound()
        {
            Map testMap = new Map(10, 10);
            testMap.InitializeGrid();

            Coordinates coord = new Coordinates();
            coord.SetCoordinates(9, 9);

            MapTile[,] extract = testMap.GetSubset(coord, 3, 3);
            Assert.IsTrue(extract.GetLength(1) == 2);
        }
示例#8
0
        public void TestGetMapExtractHasOneItem()
        {
            Map testMap = new Map(10, 10);
            testMap.InitializeGrid();

            Coordinates coord = new Coordinates();
            coord.SetCoordinates(1, 1); 
            
            Assert.IsTrue(testMap.GetSubset(coord, 3, 3).GetLength(0) > 0);
        }
示例#9
0
        public void TestTooBigParameterHeightReturnsNull()
        {
            Map testMap = new Map(3, 3);
            testMap.InitializeGrid();

            Coordinates coord = new Coordinates();
            coord.SetCoordinates(1, 1);

            MapTile[,] extract = testMap.GetSubset(coord, 5, 5);
            Assert.IsNull(extract);
        }