|
|
@ -5,49 +5,51 @@ namespace MiniGamesTests |
|
|
|
{ |
|
|
|
public class TicTacToeBrettTest |
|
|
|
{ |
|
|
|
const int LEER = TicTacToeBrett.LEER; |
|
|
|
|
|
|
|
public TicTacToeBrett TestBrett( |
|
|
|
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 |
|
|
|
int f00 = LEER, int f10 = LEER, int f20 = LEER, |
|
|
|
int f01 = LEER, int f11 = LEER, int f21 = LEER, |
|
|
|
int f02 = LEER, int f12 = LEER, int f22 = LEER |
|
|
|
) |
|
|
|
{ |
|
|
|
return new( |
|
|
|
new int[,] |
|
|
|
{ |
|
|
|
{ a, b, c, }, |
|
|
|
{ d, e, f, }, |
|
|
|
{ g, h, i, }, |
|
|
|
{ f00, f01, f02, }, |
|
|
|
{ f10, f11, f12, }, |
|
|
|
{ f20, f21, f22, }, |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[InlineData(4, 0, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 0 |
|
|
|
LEER, LEER, LEER, |
|
|
|
LEER, 0 |
|
|
|
)] |
|
|
|
[InlineData(0, 1, |
|
|
|
1 |
|
|
|
)] |
|
|
|
[InlineData(8, 2, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 2 |
|
|
|
LEER, LEER, LEER, |
|
|
|
LEER, LEER, LEER, |
|
|
|
LEER, LEER, 2 |
|
|
|
)] |
|
|
|
[InlineData(6, 3, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 3, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
LEER, LEER, LEER, |
|
|
|
LEER, LEER, LEER, |
|
|
|
3, LEER, LEER |
|
|
|
)] |
|
|
|
[InlineData(3, 4, |
|
|
|
TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
LEER, LEER, LEER, |
|
|
|
4, LEER, LEER, |
|
|
|
LEER, LEER, LEER |
|
|
|
)] |
|
|
|
public void Set_FreiesFeldBelegenTest(int pos, int wert, |
|
|
|
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 |
|
|
|
int a = LEER, int b = LEER, int c = LEER, |
|
|
|
int d = LEER, int e = LEER, int f = LEER, |
|
|
|
int g = LEER, int h = LEER, int i = LEER |
|
|
|
) |
|
|
|
{ |
|
|
|
// arrange
|
|
|
@ -207,7 +209,7 @@ namespace MiniGamesTests |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett(); |
|
|
|
int erwarteterGewinner = TicTacToeBrett.LEER; |
|
|
|
int erwarteterGewinner = LEER; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
@ -219,56 +221,56 @@ namespace MiniGamesTests |
|
|
|
[Theory] |
|
|
|
// Vertikale Reihe 1
|
|
|
|
[InlineData(0, |
|
|
|
0, 0, 0, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
0, LEER, LEER, |
|
|
|
0, LEER, LEER, |
|
|
|
0, LEER, LEER |
|
|
|
)] |
|
|
|
// Vertikale Reihe 2
|
|
|
|
[InlineData(1, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
1, 1, 1, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
LEER, 1, LEER, |
|
|
|
LEER, 1, LEER, |
|
|
|
LEER, 1, LEER |
|
|
|
)] |
|
|
|
// Vertikale Reihe 3
|
|
|
|
[InlineData(2, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
2, 2, 2 |
|
|
|
LEER, LEER, 2, |
|
|
|
LEER, LEER, 2, |
|
|
|
LEER, LEER, 2 |
|
|
|
)] |
|
|
|
// Horizontale Reihe 1
|
|
|
|
[InlineData(3, |
|
|
|
3, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
3, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
3, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
3, 3, 3, |
|
|
|
LEER, LEER, LEER, |
|
|
|
LEER, LEER, LEER |
|
|
|
)] |
|
|
|
// Horizontale Reihe 2
|
|
|
|
[InlineData(4, |
|
|
|
TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER |
|
|
|
LEER, LEER, LEER, |
|
|
|
4, 4, 4, |
|
|
|
LEER, LEER, LEER |
|
|
|
)] |
|
|
|
// Horizontale Reihe 3
|
|
|
|
[InlineData(5, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 5, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 5, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 5 |
|
|
|
LEER, LEER, LEER, |
|
|
|
LEER, LEER, LEER, |
|
|
|
5, 5, 5 |
|
|
|
)] |
|
|
|
// Diagonale Reihe links oben nach rechts unten
|
|
|
|
[InlineData(6, |
|
|
|
6, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, 6, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, 6 |
|
|
|
6, LEER, LEER, |
|
|
|
LEER, 6, LEER, |
|
|
|
LEER, 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 |
|
|
|
LEER, LEER, 7, |
|
|
|
LEER, 7, LEER, |
|
|
|
7, LEER, LEER |
|
|
|
)] |
|
|
|
public void Gewinner_VolleReihenTest(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 |
|
|
|
int a = LEER, int b = LEER, int c = LEER, |
|
|
|
int d = LEER, int e = LEER, int f = LEER, |
|
|
|
int g = LEER, int h = LEER, int i = LEER |
|
|
|
) |
|
|
|
{ |
|
|
|
// arrange
|
|
|
@ -284,34 +286,34 @@ namespace MiniGamesTests |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[InlineData( |
|
|
|
0, TicTacToeBrett.LEER, 0, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
0, TicTacToeBrett.LEER, 0 |
|
|
|
0, LEER, 0, |
|
|
|
LEER, LEER, LEER, |
|
|
|
0, LEER, 0 |
|
|
|
)] |
|
|
|
[InlineData( |
|
|
|
1, 1, TicTacToeBrett.LEER, |
|
|
|
1, 1, TicTacToeBrett.LEER, |
|
|
|
TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER |
|
|
|
1, 1, LEER, |
|
|
|
1, 1, LEER, |
|
|
|
LEER, LEER, LEER |
|
|
|
)] |
|
|
|
[InlineData( |
|
|
|
2, TicTacToeBrett.LEER, TicTacToeBrett.LEER, |
|
|
|
2, TicTacToeBrett.LEER, 2, |
|
|
|
TicTacToeBrett.LEER, 2, 2 |
|
|
|
2, 2, LEER, |
|
|
|
LEER, LEER, 2, |
|
|
|
LEER, 2, 2 |
|
|
|
)] |
|
|
|
[InlineData( |
|
|
|
1, 1, 2, |
|
|
|
1, 3, 2, |
|
|
|
2, 3, 3 |
|
|
|
1, 3, 3, |
|
|
|
2, 2, 3 |
|
|
|
)] |
|
|
|
public void Gewinner_NichtVolleReihenTest( |
|
|
|
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 |
|
|
|
int a = LEER, int b = LEER, int c = LEER, |
|
|
|
int d = LEER, int e = LEER, int f = LEER, |
|
|
|
int g = LEER, int h = LEER, int i = LEER |
|
|
|
) |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
TicTacToeBrett brett = TestBrett(a, b, c, d, e, f, g, h, i); |
|
|
|
int erwarteterGewinner = TicTacToeBrett.LEER; |
|
|
|
int erwarteterGewinner = LEER; |
|
|
|
|
|
|
|
// act
|
|
|
|
int erhaltenerGewinner = brett.Gewinner(); |
|
|
|