public void TestNullParameterReturnsNull() { Map testMap = new Map(10, 10); testMap.InitializeGrid(); MapTile[,] extract = testMap.GetSubset(null, 3, 3); Assert.IsNull(extract); }
/// <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>(); }
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)); }
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); }
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); }
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); }
/// <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); }
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); }
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); }
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); }