Browse Source

TicTacToe.SpielerInput wechselt den aktiven Spieler

feature/tictactoe
Felix Detig 2 years ago
parent
commit
c237f579a3
  1. 1
      BlazorSolution/MiniGames/Client/ViewModel/TicTacToe.cs
  2. 4
      BlazorSolution/MiniGamesTests/TicTacToeTest.cs

1
BlazorSolution/MiniGames/Client/ViewModel/TicTacToe.cs

@ -26,6 +26,7 @@ namespace MiniGames.Client.ViewModel
public void SpielerInput(int posIndex) public void SpielerInput(int posIndex)
{ {
Brett.Set(posIndex, AktiverSpielerIndex); Brett.Set(posIndex, AktiverSpielerIndex);
SpielerWechsel();
} }
public void SpielerWechsel() public void SpielerWechsel()

4
BlazorSolution/MiniGamesTests/TicTacToeTest.cs

@ -64,6 +64,9 @@ namespace MiniGamesTests
{ {
// arrange // arrange
TicTacToe spiel = StandardSpiel(); TicTacToe spiel = StandardSpiel();
spiel.AktiverSpielerIndex = 0;
int erwarteterSpielerIndex = 1;
int pos = 2; int pos = 2;
TicTacToeBrett erwartetesBrett = new(new int[,] TicTacToeBrett erwartetesBrett = new(new int[,]
{ {
@ -77,6 +80,7 @@ namespace MiniGamesTests
// assert // assert
Assert.True(spiel.Brett.Gleich(erwartetesBrett)); Assert.True(spiel.Brett.Gleich(erwartetesBrett));
Assert.Equal(erwarteterSpielerIndex, spiel.AktiverSpielerIndex);
} }
} }
} }
Loading…
Cancel
Save