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