optimized board class + added 1 test that fucking doesn't work

test_old_branch
Jules LASCRET 1 year ago
parent 867f542f3d
commit 3850cc8873

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// ReSharper disable All
namespace QwirkleClassLibrary
{
@ -31,16 +30,7 @@ namespace QwirkleClassLibrary
{
if (this.Cells[i].GetX == x && this.Cells[i].GetY == y)
{
if (Cells[i].IsFree == true)
{
return Cells[i].SetTile(tile);
}
else
{
return false;
}
return Cells[i].IsFree == false && Cells[i].SetTile(tile);
}
}
return false;

@ -11,6 +11,11 @@ public class Cell
public Cell(int x, int y)
{
if (this.x < 0 || this.y < 0)
{
throw new ArgumentException("");
}
this.x = x;
this.y = y;
}

@ -0,0 +1,21 @@
using QwirkleClassLibrary;
namespace TestBase;
public class TestCell
{
[Theory]
[InlineData(true, 10, 20, 10, 20)]
[InlineData(false, -10, 20, -10, 20)]
public void Test_CellConstructor(bool isValid, int expectedX, int expectedY, int x, int y)
{
if (!isValid)
{
Assert.Throws<ArgumentException>(() => new Cell(x, y));
}
Cell c = new Cell(x, y);
Assert.Equal(expectedX, x);
Assert.Equal(expectedY, y);
}
}
Loading…
Cancel
Save