Ajout de deux tests sur le calcul des zones + résolution d'un problème sur le code de cette même fonction

pull/91/head
Remi NEVEU 11 months ago committed by Rémi LAVERGNE
parent 8f3468c863
commit 407ded9e14

@ -232,7 +232,7 @@ namespace Models.Rules
calculus += zones[i].Count - 1 + zones[i][0].Value;
if (zones[i].Count > 9)
{
calculus += (zones[i].Count - 9) * 5;
calculus += (zones[i].Count - 9) * 5 - (zones[i].Count - 9);
}
}
return calculus;

@ -462,17 +462,64 @@ public class RulesTests
Assert.Equal(0, rules.FinalCalculusOfZones(new List<List<Cell>>()));
}
/*
[Fact]
public void FinalCalculusOfZones_ReturnsCorrectValue_WhenZonesAreNotEmpty()
{
// TODO
Rules rules = new Rules();
Cell cell = new Cell(0, 0);
cell.Value = 1;
Cell cell1 = new Cell(0, 1);
cell1.Value = 1;
Cell cell2 = new Cell(0, 2);
cell2.Value = 1;
Cell uncell = new Cell(0, 0);
uncell.Value = 4;
Cell deuxcell = new Cell(0, 1);
deuxcell.Value = 4;
Cell troiscell = new Cell(0, 2);
troiscell.Value = 4;
List<List<Cell>> zones = new List<List<Cell>>
{
new List<Cell> { cell, cell1, cell2 },
new List<Cell> { uncell, deuxcell, troiscell }
};
Assert.Equal(9, rules.FinalCalculusOfZones(zones));
}
[Fact]
public void FinalCalculusOfZones_ReturnsCorrectValue_WhenZoneCountIsGreaterThanNine()
{
// TODO
Rules rules = new Rules();
Cell cell = new Cell(0, 0);
cell.Value = 5;
Cell cell1 = new Cell(0, 1);
cell1.Value = 5;
Cell cell2 = new Cell(0, 2);
cell2.Value = 5;
Cell cell3 = new Cell(0, 3);
cell3.Value = 5;
Cell cell4 = new Cell(0, 4);
cell4.Value = 5;
Cell cell5 = new Cell(0, 5);
cell5.Value = 5;
Cell cell6 = new Cell(1, 0);
cell6.Value = 5;
Cell cell7 = new Cell(1, 1);
cell7.Value = 5;
Cell cell8 = new Cell(1, 2);
cell8.Value = 5;
Cell cell9 = new Cell(1, 3);
cell9.Value = 5;
Cell cell10 = new Cell(1, 4);
cell10.Value = 5;
List<List<Cell>> zones = new List<List<Cell>>
{
new List<Cell> { cell, cell1, cell2, cell3, cell4, cell5, cell6, cell7, cell8, cell9, cell10 }
};
Assert.Equal(23, rules.FinalCalculusOfZones(zones));
}
*/
}
Loading…
Cancel
Save