public void TestTileIndexer() { const int X = 1; const int Y = 2; var mapTile = new MapTile(X, Y, "Desert"); this.map[X, Y] = mapTile; Assert.AreEqual(mapTile, this.map[X, Y]); }
public void CreateNewMap() { int width; int height; try { width = int.Parse(this.newMapWindow.TextBoxMapWidth.Text); } catch (FormatException) { ShowErrorMessage("Incorrect Width", "Please type in Width"); return; } try { height = int.Parse(this.newMapWindow.TextBoxMapHeight.Text); } catch (FormatException) { ShowErrorMessage("Incorrect Height", "Please type in Height"); return; } try { map = new Map(width, height); } catch (ArgumentOutOfRangeException e) { ShowErrorMessage("Incorrect Map Size", e.Message); return; } string defaultMapTile = this.newMapWindow.SelectedMapTileType; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { map[x, y] = new MapTile(x, y, defaultMapTile); } } this.newMapWindow.Close(); }