|
|
@ -198,138 +198,64 @@ namespace MiniGamesTests |
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_VertikaleReihe1Test() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett(0, 0, 0); |
|
|
|
int erwarteterGewinner = 0; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_VertikaleReihe2Test() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett( |
|
|
|
[Theory] |
|
|
|
// Vertikale Reihe 1
|
|
|
|
[InlineData(0, |
|
|
|
0, 0, 0, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
0, 0, 0 |
|
|
|
); |
|
|
|
int erwarteterGewinner = 0; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_VertikaleReihe3Test() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett( |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
)] |
|
|
|
// Vertikale Reihe 2
|
|
|
|
[InlineData(1, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
1, 1, 1, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
)] |
|
|
|
// Vertikale Reihe 3
|
|
|
|
[InlineData(2, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
1, 1, 1 |
|
|
|
); |
|
|
|
int erwarteterGewinner = 1; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_HorizontaleReihe1Test() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett( |
|
|
|
2, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
2, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
2 |
|
|
|
); |
|
|
|
int erwarteterGewinner = 2; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_HorizontaleReihe2Test() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett( |
|
|
|
TicTacToeBrett.LEER, 3, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 3, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 3, TicTacToeBrett.LEER |
|
|
|
); |
|
|
|
int erwarteterGewinner = 3; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_HorizontaleReihe3Test() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett( |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 4, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 4, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 4 |
|
|
|
); |
|
|
|
int erwarteterGewinner = 4; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_DiagonaleReiheNWzuSO() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett( |
|
|
|
5, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 5, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
2, 2, 2 |
|
|
|
)] |
|
|
|
// Horizontale Reihe 1
|
|
|
|
[InlineData(3, |
|
|
|
3, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
3, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
3, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
)] |
|
|
|
// Horizontale Reihe 2
|
|
|
|
[InlineData(4, |
|
|
|
TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER |
|
|
|
)] |
|
|
|
// Horizontale Reihe 3
|
|
|
|
[InlineData(5, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 5, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 5, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 5 |
|
|
|
); |
|
|
|
int erwarteterGewinner = 5; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(erwarteterGewinner, erhaltenerGewinner); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Gewinner_DiagonaleReiheNOzuSW() |
|
|
|
)] |
|
|
|
// Diagonale Reihe links oben nach rechts unten
|
|
|
|
[InlineData(6, |
|
|
|
6, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 6, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 6 |
|
|
|
)] |
|
|
|
// Diagonale Reihe rechts oben nach links unten
|
|
|
|
[InlineData(7, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 7, |
|
|
|
TicTacToeBrett.LEER, 7, TicTacToeBrett.LEER, |
|
|
|
7, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
)] |
|
|
|
public void Gewinner_VolleReihen(int gewinner, |
|
|
|
int a = TicTacToeBrett.LEER, int b = TicTacToeBrett.LEER, int c = TicTacToeBrett.LEER, |
|
|
|
int d = TicTacToeBrett.LEER, int e = TicTacToeBrett.LEER, int f = TicTacToeBrett.LEER, |
|
|
|
int g = TicTacToeBrett.LEER, int h = TicTacToeBrett.LEER, int i = TicTacToeBrett.LEER |
|
|
|
) |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett( |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 6, |
|
|
|
TicTacToeBrett.LEER, 6, TicTacToeBrett.LEER, |
|
|
|
6, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
); |
|
|
|
int erwarteterGewinner = 6; |
|
|
|
TicTacToeBrett brett = TestBrett(a, b, c, d, e, f, g, h, i); |
|
|
|
int erwarteterGewinner = gewinner; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|