0 smell ? yes !
continuous-integration/drone/push Build is passing Details

test_old_branch
Jérémy Mouyon 11 months ago
parent 028de27909
commit 697c2e2e55

@ -45,14 +45,15 @@ public class TestBoard
Assert.True(b.AddTileInCell(x, y, t)); Assert.True(b.AddTileInCell(x, y, t));
} }
public static TheoryData<int, int, Tile> Data_BoardDouble() public static TheoryData<int, int, Shape, Color> Data_BoardDouble()
{ {
var data = new TheoryData<int, int, Tile> var data = new TheoryData<int, int, Shape, Color>
{ {
{ {
1, 1,
2, 2,
new Tile(Shape.Round, Color.Red) Shape.Round,
Color.Red
} }
}; };
@ -61,8 +62,9 @@ public class TestBoard
[Theory] [Theory]
[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, Shape s, Color c)
{ {
Tile t = new(s, c);
Board board = new Board(12, 12); 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));
@ -93,8 +95,6 @@ public class TestBoard
} }
Assert.False(board.HasOccupiedCase()); Assert.False(board.HasOccupiedCase());
return;
} }
[Theory] [Theory]
@ -112,8 +112,6 @@ public class TestBoard
} }
Assert.Null(board.GetCell(900, 900)); Assert.Null(board.GetCell(900, 900));
return;
} }
[Fact] [Fact]
public void Test_EventBoard() public void Test_EventBoard()

@ -23,27 +23,36 @@ public class TestCell
Assert.Equal(y, c.GetY); Assert.Equal(y, c.GetY);
} }
public static TheoryData<bool, int, int, Shape, Color> Data_Cell()
public static IEnumerable<object[]> Data_Cell() {
var data = new TheoryData<bool, int, int, Shape, Color>
{ {
yield return new object[]
{ {
true, true,
new Cell(0,0), 0,
new Tile(Shape.Round, Color.Red) 0,
}; Shape.Round,
yield return new object[] Color.Red
},
{ {
false, false,
new Cell(0,0), 0,
new Tile(Shape.Round, Color.Red) 0,
Shape.Round,
Color.Red
}
}; };
return data;
} }
[Theory] [Theory]
[MemberData(nameof(Data_Cell))] [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) if (!except)
{ {
c.SetTile(t); c.SetTile(t);
@ -55,9 +64,12 @@ public class TestCell
[Theory] [Theory]
[MemberData(nameof(Data_Cell))] [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); c.SetTile(t);
Assert.False(c.IsFree); Assert.False(c.IsFree);

@ -18,15 +18,18 @@ namespace TestBase
Assert.Equal(Color.Blue, t.GetColor); Assert.Equal(Color.Blue, t.GetColor);
} }
public static TheoryData<Tile> Data_Tile() public static TheoryData<Shape, Color> Data_Tile()
{ {
var data = new TheoryData<Tile> var data = new TheoryData<Shape, Color>
{ {
{ {
new Tile(Shape.Round, Color.Green) Shape.Round,
Color.Green
}, },
{ {
new Tile(Shape.Shuriken, Color.Red) Shape.Shuriken,
Color.Red
} }
}; };
return data; return data;
@ -34,8 +37,11 @@ namespace TestBase
[Theory] [Theory]
[MemberData(nameof(Data_Tile))] [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; Shape s = t.GetShape;
Color c = t.GetColor; Color c = t.GetColor;
string str = (c.ToString() + s.ToString()); string str = (c.ToString() + s.ToString());

Loading…
Cancel
Save