🛠️ efonte des tests de Cellule
continuous-integration/drone/push Build is failing Details

pull/64/head
Rémi LAVERGNE 12 months ago
parent 16a8b881e5
commit 1ff57b71c3
No known key found for this signature in database
GPG Key ID: CA264B55E97FD220

@ -4,10 +4,47 @@ using Models;
public class CellTest public class CellTest
{ {
[Fact] [Fact]
public void CellConstructorTest() public void CellConstructor_SetsCorrectValues()
{ {
Cell cell = new Cell(0, 0); var cell = new Cell(1, 2, true);
Assert.Equal(0, cell.Pos.X);
Assert.Equal(0,cell.Pos.Y); Assert.Equal(1, cell.X);
Assert.Equal(2, cell.Y);
Assert.True(cell.GetCellType());
}
[Fact]
public void CellConstructor_SetsDefaultValues()
{
var cell = new Cell(1, 2);
Assert.Equal(1, cell.X);
Assert.Equal(2, cell.Y);
Assert.False(cell.GetCellType());
}
[Fact]
public void ValueSetter_ThrowsException_WhenValueIsNegative()
{
var cell = new Cell(1, 2);
Assert.Throws<Exception>(() => cell.Value = -1);
}
[Fact]
public void ValueSetter_SetsValue_WhenValueIsPositive()
{
var cell = new Cell(1, 2);
cell.Value = 5;
Assert.Equal(5, cell.Value);
}
[Fact]
public void ValueSetter_SetsValue_WhenValueIsNull()
{
var cell = new Cell(1, 2);
Assert.Null(cell.Value);
} }
} }
Loading…
Cancel
Save