diff --git a/Qwirkle/TestBase/TestBoard.cs b/Qwirkle/TestBase/TestBoard.cs index c2408a7..d5e0823 100644 --- a/Qwirkle/TestBase/TestBoard.cs +++ b/Qwirkle/TestBase/TestBoard.cs @@ -45,14 +45,15 @@ public class TestBoard Assert.True(b.AddTileInCell(x, y, t)); } - public static TheoryData Data_BoardDouble() + public static TheoryData Data_BoardDouble() { - var data = new TheoryData + var data = new TheoryData { { 1, 2, - new Tile(Shape.Round, Color.Red) + Shape.Round, + Color.Red } }; @@ -61,8 +62,9 @@ public class TestBoard [Theory] [MemberData(nameof(Data_BoardDouble))] - public void Test_BoardFree(int x, int y, Tile t) + public void Test_BoardFree(int x, int y, Shape s, Color c) { + Tile t = new(s, c); Board board = new Board(12, 12); board.AddTileInCell(x, y, t); Assert.False(board.AddTileInCell(x, y, t)); @@ -93,8 +95,6 @@ public class TestBoard } Assert.False(board.HasOccupiedCase()); - return; - } [Theory] @@ -112,8 +112,6 @@ public class TestBoard } Assert.Null(board.GetCell(900, 900)); - return; - } [Fact] public void Test_EventBoard() diff --git a/Qwirkle/TestBase/TestCell.cs b/Qwirkle/TestBase/TestCell.cs index 954c1f4..b173772 100644 --- a/Qwirkle/TestBase/TestCell.cs +++ b/Qwirkle/TestBase/TestCell.cs @@ -23,27 +23,36 @@ public class TestCell Assert.Equal(y, c.GetY); } - - public static IEnumerable Data_Cell() + public static TheoryData Data_Cell() { - yield return new object[] - { - true, - new Cell(0,0), - new Tile(Shape.Round, Color.Red) - }; - yield return new object[] + var data = new TheoryData { - false, - new Cell(0,0), - new Tile(Shape.Round, Color.Red) + { + true, + 0, + 0, + Shape.Round, + Color.Red + + }, + { + false, + 0, + 0, + Shape.Round, + Color.Red + } }; + return data; } [Theory] [MemberData(nameof(Data_Cell))] - public void Test_CellSetTile(bool except, Cell c, Tile t) + public void Test_CellSetTile(bool except, int x, int y, Shape shape, Color color) { + Tile t = new(shape, color); + Cell c = new(x, y); + if (!except) { c.SetTile(t); @@ -55,9 +64,12 @@ public class TestCell [Theory] [MemberData(nameof(Data_Cell))] - public void Test_IsFree(bool except, Cell c, Tile t) + public void Test_IsFree(bool except, int x, int y, Shape shape, Color color) { - if (except == false) + Tile t = new(shape, color); + Cell c = new(x, y); + + if (!except) { c.SetTile(t); Assert.False(c.IsFree); diff --git a/Qwirkle/TestBase/TestTile.cs b/Qwirkle/TestBase/TestTile.cs index 9589649..9acd9a5 100644 --- a/Qwirkle/TestBase/TestTile.cs +++ b/Qwirkle/TestBase/TestTile.cs @@ -18,15 +18,18 @@ namespace TestBase Assert.Equal(Color.Blue, t.GetColor); } - public static TheoryData Data_Tile() + public static TheoryData Data_Tile() { - var data = new TheoryData + var data = new TheoryData { { - new Tile(Shape.Round, Color.Green) + Shape.Round, + Color.Green + }, { - new Tile(Shape.Shuriken, Color.Red) + Shape.Shuriken, + Color.Red } }; return data; @@ -34,8 +37,11 @@ namespace TestBase [Theory] [MemberData(nameof(Data_Tile))] - public void Test_Name(Tile t) + public void Test_Name(Shape shape, Color color) + { + Tile t = new(shape, color); + Shape s = t.GetShape; Color c = t.GetColor; string str = (c.ToString() + s.ToString());