diff --git a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs index 4fe20d0..13a9c46 100644 --- a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs +++ b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs @@ -105,6 +105,11 @@ namespace MiniGames.Shared.Models return Felder[0, 0]; } + if (dreiGleichGefuellt(Felder[2, 0], Felder[1, 1], Felder[0, 2])) + { + return Felder[2, 0]; + } + return LEER; } } diff --git a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs index 9351135..b2d3422 100644 --- a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs +++ b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs @@ -318,5 +318,24 @@ namespace MiniGamesTests // assert Assert.Equal(erwarteterGewinner, erhaltenerGewinner); } + + + [Fact] + public void Gewinner_DiagonaleReiheNOzuSW() + { + // arrange + TicTacToeBrett brett = TestBrett( + TicTacToeBrett.LEER, TicTacToeBrett.LEER, 6, + TicTacToeBrett.LEER, 6, TicTacToeBrett.LEER, + 6, TicTacToeBrett.LEER, TicTacToeBrett.LEER + ); + int erwarteterGewinner = 6; + + // act + int erhaltenerGewinner = brett.Gewinner(); + + // assert + Assert.Equal(erwarteterGewinner, erhaltenerGewinner); + } } }