diff --git a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs index 811c25b..a340ddd 100644 --- a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs +++ b/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; } } } diff --git a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs index c688c91..ac5cf3a 100644 --- a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs +++ b/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); + } } }