|
@ -0,0 +1,66 @@ |
|
|
|
|
|
using System; |
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
using System.Text; |
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using Xunit; |
|
|
|
|
|
|
|
|
|
|
|
using MiniGames.Shared.Models; |
|
|
|
|
|
using MiniGames.Client.ViewModel; |
|
|
|
|
|
|
|
|
|
|
|
namespace MiniGamesTests |
|
|
|
|
|
{ |
|
|
|
|
|
public class TicTacToeTest |
|
|
|
|
|
{ |
|
|
|
|
|
int[,] StandardKarte() |
|
|
|
|
|
{ |
|
|
|
|
|
return new int[,] |
|
|
|
|
|
{ |
|
|
|
|
|
{ -1, -1, -1, }, |
|
|
|
|
|
{ -1, -1, -1, }, |
|
|
|
|
|
{ -1, -1, -1, }, |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SpielerModel[] StandardSpieler() |
|
|
|
|
|
{ |
|
|
|
|
|
return new SpielerModel[] |
|
|
|
|
|
{ |
|
|
|
|
|
new SpielerModel |
|
|
|
|
|
{ |
|
|
|
|
|
SpielerName = "Spieler 1", |
|
|
|
|
|
Punkte = 0 |
|
|
|
|
|
}, |
|
|
|
|
|
new SpielerModel |
|
|
|
|
|
{ |
|
|
|
|
|
SpielerName = "Spieler 2", |
|
|
|
|
|
Punkte = 1 |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TicTacToeModel StandardModel() |
|
|
|
|
|
{ |
|
|
|
|
|
return new TicTacToeModel |
|
|
|
|
|
{ |
|
|
|
|
|
Spieler = StandardSpieler(), |
|
|
|
|
|
Karte = StandardKarte(), |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Theory] |
|
|
|
|
|
[InlineData(0, 4, true)] |
|
|
|
|
|
private void SpielerInput_FreiesFeldBelegenTest(int spielerIndex, int posIndex, bool gesetzt) |
|
|
|
|
|
{ |
|
|
|
|
|
// arrange
|
|
|
|
|
|
TicTacToe spiel = new(StandardModel()); |
|
|
|
|
|
bool erwartetGesetzt = gesetzt; |
|
|
|
|
|
|
|
|
|
|
|
// act
|
|
|
|
|
|
bool erhaltenGesetzt = spiel.SpielerInput(spielerIndex, posIndex); |
|
|
|
|
|
|
|
|
|
|
|
// assert
|
|
|
|
|
|
Assert.Equal(erwartetGesetzt, erhaltenGesetzt); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |