diff --git a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs index 6edae49..46142a5 100644 --- a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs +++ b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs @@ -81,6 +81,11 @@ namespace MiniGames.Shared.Models public int Gewinner() { + if (Felder[0, 0] == Felder[0, 1] && Felder[0, 1] == Felder[0, 2] && Felder[0, 0] != LEER) + { + return Felder[0, 0]; + } + return LEER; } } diff --git a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs index 1985467..fd16442 100644 --- a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs +++ b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs @@ -197,5 +197,19 @@ namespace MiniGamesTests // assert Assert.Equal(erwarteterGewinner, erhaltenerGewinner); } + + [Fact] + public void Gewinner_VertikaleReihe1Test() + { + // arrange + TicTacToeBrett brett = TestBrett(0, 0, 0); + int erwarteterGewinner = 0; + + // act + int erhaltenerGewinner = brett.Gewinner(); + + // assert + Assert.Equal(erwarteterGewinner, erhaltenerGewinner); + } } }