public void TestCanSwapMethodToReturnFalseValueWhenCurrentTileCannotBeSwapped() { var grid = new Grid(); for (int i = 0; i < 5; i++) { var tile = new Tile(string.Empty + i + string.Empty, i, TileType.Number); grid.AddTile(tile); } var emptyTile = new Tile(string.Empty, GlobalConstants.TotalTilesCount - 1, TileType.Empty); grid.AddTile(emptyTile); var tileToTest = grid.GetTileFromLabel("1"); var actual = grid.CanSwap(tileToTest); var expected = false; Assert.AreEqual(expected, actual); }
public void TestCanSwapMethodToReturnFalseValueWhenCurrentTileCanBeSwapped() { var grid = new Grid(); for (int i = 0; i < 5; i++) { var tile = new Tile(i.ToString(), i, TileType.Number); grid.AddTile(tile); } var emptyTile = new Tile(string.Empty, 5, TileType.Empty); grid.AddTile(emptyTile); var tileToTest = grid.GetTileFromLabel("4"); var actual = grid.CanSwap(tileToTest); var expected = true; Assert.AreEqual(expected, actual); }
public void TestGetTileFromLabelMethodToReturnValidTile() { var grid = new Grid(); var tile = new Tile("1", 1, TileType.Number); var anotherTile = new Tile("2", 2, TileType.Number); grid.AddTile(tile); grid.AddTile(anotherTile); var actual = grid.GetTileFromLabel("2"); var expected = anotherTile; Assert.AreEqual(expected, actual); }
public void TestGetTileFromLabelMethodToReturnNullWhenNoValidDataIsProvided() { var grid = new Grid(); var tile = new Tile("1", 1, TileType.Number); var anotherTile = new Tile("2", 2, TileType.Number); grid.AddTile(tile); grid.AddTile(anotherTile); var actual = grid.GetTileFromLabel("3"); Assert.AreEqual(null, actual); }