本文整理汇总了C#中Grid.GetTileFromLabel方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.GetTileFromLabel方法的具体用法?C# Grid.GetTileFromLabel怎么用?C# Grid.GetTileFromLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid
的用法示例。
在下文中一共展示了Grid.GetTileFromLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCanSwapMethodToReturnFalseValueWhenCurrentTileCannotBeSwapped
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);
}
示例2: TestCanSwapMethodToReturnFalseValueWhenCurrentTileCanBeSwapped
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);
}
示例3: TestGetTileFromLabelMethodToReturnValidTile
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);
}
示例4: TestGetTileFromLabelMethodToReturnNullWhenNoValidDataIsProvided
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);
}