public void Resize_NewCellsHaveDefaultValue() { var startWidth = 10; var startHeight = 10; var startDepth = 10; var defaultVal = 5; var grid = new Grid3D <int>(startWidth, startHeight, startDepth, defaultVal); grid.Clear(10); grid.Resize(20, 20, 20); for (var x = 0; x < grid.Width; x++) { for (var y = 0; y < grid.Height; y++) { for (var z = 0; z < grid.Depth; z++) { if (x >= startWidth || y >= startHeight || z >= startDepth) { Assert.AreEqual(defaultVal, grid[x, y, z], "({0},{1},{2})", x, y, z); } else { Assert.AreEqual(10, grid[x, y, z], "({0},{1},{2})", x, y, z); } } } } }
public void Clear_Default_AllCleared() { var grid = new Grid3D <int>(100, 50, 24, 33); grid.Clear(1); grid.Clear(); for (var x = 0; x < grid.Width; x++) { for (var y = 0; y < grid.Height; y++) { for (var z = 0; z < grid.Depth; z++) { Assert.AreEqual(33, grid[x, y, z], "({0},{1},{2})", x, y, z); } } } }