Browse Source

TicTacToeBrett.Voll erkennt volles Brett

feature/tictactoe
Felix Detig 3 years ago
parent
commit
a1129e542d
  1. 13
      BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs
  2. 14
      BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs

13
BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs

@ -63,7 +63,18 @@ namespace MiniGames.Shared.Models
public bool Voll()
{
return false;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (Felder[i, j] == -1)
{
return false;
}
}
}
return true;
}
}
}

14
BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs

@ -149,5 +149,19 @@ namespace MiniGamesTests
// assert
Assert.Equal(erwartetVoll, erhaltenVoll);
}
[Fact]
public void Voll_VollesBrettTest()
{
// arrange
TicTacToeBrett brett = TestBrett(1, 2, 3, 4, 5, 6, 7, 8, 9);
bool erwartetVoll = true;
// act
bool erhaltenVoll = brett.Voll();
// assert
Assert.Equal(erwartetVoll, erhaltenVoll);
}
}
}
Loading…
Cancel
Save