diff --git a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs index 8f2ab97..68d1b0d 100644 --- a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs +++ b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs @@ -65,8 +65,8 @@ namespace MiniGames.Shared.Models public bool Set(int pos, int wert) { - int x = pos / 3; - int y = pos % 3; + int x = pos % 3; + int y = pos / 3; try { diff --git a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs index 36ea54a..cb18287 100644 --- a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs +++ b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs @@ -21,20 +21,38 @@ namespace MiniGamesTests ); } - [Fact] - public void Set_FreiesFeldBelegenTest() + [Theory] + [InlineData(4, 0, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, + TicTacToeBrett.LEER, 0 + )] + [InlineData(0, 1, + 1 + )] + [InlineData(8, 2, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, 2 + )] + [InlineData(6, 3, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, 3, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER + )] + [InlineData(3, 4, + TicTacToeBrett.LEER, 4, TicTacToeBrett.LEER, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER, + TicTacToeBrett.LEER, TicTacToeBrett.LEER, TicTacToeBrett.LEER + )] + public void Set_FreiesFeldBelegenTest(int pos, int wert, + int a = TicTacToeBrett.LEER, int b = TicTacToeBrett.LEER, int c = TicTacToeBrett.LEER, + int d = TicTacToeBrett.LEER, int e = TicTacToeBrett.LEER, int f = TicTacToeBrett.LEER, + int g = TicTacToeBrett.LEER, int h = TicTacToeBrett.LEER, int i = TicTacToeBrett.LEER + ) { // arrange TicTacToeBrett brett = new(); - TicTacToeBrett erwartetesBrett = TestBrett( - TicTacToeBrett.LEER, - TicTacToeBrett.LEER, - TicTacToeBrett.LEER, - TicTacToeBrett.LEER, - 0 - ); - int pos = 4; - int wert = 0; + TicTacToeBrett erwartetesBrett = TestBrett(a, b, c, d, e, f, g, h, i); bool erwartetGesetzt = true; // act