adding test for getCells and getReadCells

test_old_branch
rportet 12 months ago
parent 1302714adb
commit cfa84886d0

@ -1,8 +1,9 @@
using QwirkleClassLibrary; using QwirkleClassLibrary;
using System.Collections.ObjectModel;
namespace TestBase; namespace TestBase;
public class TestBoard public class TestBoard
{ {
public static IEnumerable<object[]> Data_Board() public static IEnumerable<object[]> Data_Board()
{ {
yield return new object[] yield return new object[]
@ -26,7 +27,7 @@ namespace TestBase;
public void Test_BoardAddSolo(bool except, int x, int y, Tile t) public void Test_BoardAddSolo(bool except, int x, int y, Tile t)
{ {
Board b = new Board(); Board b = new Board(x, y);
if (!except) if (!except)
{ {
@ -51,9 +52,50 @@ namespace TestBase;
[MemberData(nameof(Data_BoardDouble))] [MemberData(nameof(Data_BoardDouble))]
public void Test_BoardFree(int x, int y, Tile t) public void Test_BoardFree(int x, int y, Tile t)
{ {
Board board = new Board(); Board board = new Board(12, 12);
board.AddTileInCell(x, y, t); board.AddTileInCell(x, y, t);
Assert.False(board.AddTileInCell(x, y, t)); Assert.False(board.AddTileInCell(x, y, t));
} }
[Fact]
public void Test_GetCells()
{
Board board = new Board(12, 12);
List<Cell> cells = new List<Cell>();
for (int a = 0; a<12; a++)
{
for (int b = 0; b<12; b++)
{
Cell localcell = new(a, b);
cells.Add(localcell);
}
}
Assert.Equal(cells, board.GetCells());
}
[Fact]
public void Test_GetReadCells()
{
Board board = new Board(12, 12);
List<Cell> cells = new List<Cell>();
for (int a = 0; a < 12; a++)
{
for (int b = 0; b < 12; b++)
{
Cell localcell = new(a, b);
cells.Add(localcell);
} }
}
ReadOnlyCollection<Cell> readCells = cells.AsReadOnly();
Assert.Equal(readCells, board.GetReadCells());
}
}

Loading…
Cancel
Save