예제 #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
파일: World.cs 프로젝트: Timothep/Cells.net
        /// <summary>
        /// Constructor
        /// </summary>
        public World()
        {
            this.displayController  = NinjectGlobalKernel.GlobalKernel.Get<IDisplayController>();
            this.mapFactory = this.localKernel.Get<IMapFactory>();

            this.masterMap          = new Map(Settings.Default.WorldWidth, Settings.Default.WorldHeight);
            this.cells              = new List<IInternalCell>();
        }
예제 #3
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));
 }
예제 #4
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);
 }
예제 #5
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);
 }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
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);
        }
예제 #9
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);
        }
예제 #10
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);
        }