|
|
|
@ -32,7 +32,7 @@ public class RulesTests
|
|
|
|
|
public void IsCellValid_ReturnsFalse_WhenCellIsNotEmptyAndHasAdjacentCells()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
Cell selectedCell = map.Boards[0];
|
|
|
|
|
selectedCell.Value = 5;
|
|
|
|
|
Assert.False(rules.IsCellValid(selectedCell, map.Boards.ToList()));
|
|
|
|
@ -42,7 +42,7 @@ public class RulesTests
|
|
|
|
|
public void IsCellValid_ReturnsTrue_WhenCellIsEmptyAndHasAdjacentCells()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
Cell selectedCell = map.Boards[0];
|
|
|
|
|
Assert.True(rules.IsCellValid(selectedCell, map.Boards.ToList()));
|
|
|
|
|
}
|
|
|
|
@ -80,7 +80,7 @@ public class RulesTests
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Cell cell1 = new Cell(0, 0);
|
|
|
|
|
Cell cell2 = new Cell(0, 1);
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
map.RopePaths.Add(new List<Cell> { cell1, cell2 });
|
|
|
|
|
Assert.True(rules.IsInRopePaths(cell2, map.RopePaths, 0));
|
|
|
|
|
}
|
|
|
|
@ -91,7 +91,7 @@ public class RulesTests
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Cell cell1 = new Cell(0, 0);
|
|
|
|
|
Cell cell2 = new Cell(0, 1);
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
map.RopePaths.Add(new List<Cell> { cell1 });
|
|
|
|
|
Assert.False(rules.IsInRopePaths(cell2, map.RopePaths, 0));
|
|
|
|
|
}
|
|
|
|
@ -102,7 +102,7 @@ public class RulesTests
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Cell cell1 = new Cell(0, 0);
|
|
|
|
|
Cell cell2 = new Cell(0, 1);
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
map.RopePaths.Add(new List<Cell> { cell1 });
|
|
|
|
|
map.RopePaths.Add(new List<Cell> { cell2 });
|
|
|
|
|
Assert.True(rules.IsInRopePaths(cell2, map.RopePaths, 0));
|
|
|
|
@ -116,7 +116,7 @@ public class RulesTests
|
|
|
|
|
Cell cell2 = new Cell(0, 1);
|
|
|
|
|
cell1.Value = 5;
|
|
|
|
|
cell2.Value = 5;
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
map.RopePaths.Add(new List<Cell> { cell1, cell2 });
|
|
|
|
|
Assert.True(rules.AsValue(cell2, map.RopePaths, 0));
|
|
|
|
|
}
|
|
|
|
@ -129,7 +129,7 @@ public class RulesTests
|
|
|
|
|
Cell cell2 = new Cell(0, 1);
|
|
|
|
|
cell1.Value = 5;
|
|
|
|
|
cell2.Value = 5;
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
map.RopePaths.Add(new List<Cell> { cell1 });
|
|
|
|
|
Assert.True(rules.AsValue(cell2, map.RopePaths, 0));
|
|
|
|
|
}
|
|
|
|
@ -142,7 +142,7 @@ public class RulesTests
|
|
|
|
|
Cell cell2 = new Cell(0, 1);
|
|
|
|
|
cell1.Value = 5;
|
|
|
|
|
cell2.Value = 6;
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
map.RopePaths.Add(new List<Cell> { cell1 });
|
|
|
|
|
Assert.False(rules.AsValue(cell2, map.RopePaths, 0));
|
|
|
|
|
}
|
|
|
|
@ -186,7 +186,7 @@ public class RulesTests
|
|
|
|
|
public void IsZoneValidAndAddToZones_DoesNothing_WhenCellIsNull()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
rules.IsZoneValidAndAddToZones(null, map);
|
|
|
|
|
Assert.Empty(map.Zones);
|
|
|
|
|
}
|
|
|
|
@ -195,7 +195,7 @@ public class RulesTests
|
|
|
|
|
public void IsZoneValidAndAddToZones_DoesNothing_WhenCellValueIsNull()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
Cell cell = new Cell(0, 0);
|
|
|
|
|
rules.IsZoneValidAndAddToZones(cell, map);
|
|
|
|
|
Assert.Empty(map.Zones);
|
|
|
|
@ -371,7 +371,7 @@ public class RulesTests
|
|
|
|
|
public void NewZoneIsCreated_DoesNothing_WhenFirstCellIsNull()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
rules.NewZoneIsCreated(null, new Cell(0, 0), map);
|
|
|
|
|
Assert.Empty(map.Zones);
|
|
|
|
|
}
|
|
|
|
@ -380,7 +380,7 @@ public class RulesTests
|
|
|
|
|
public void NewZoneIsCreated_DoesNothing_WhenSecondCellIsNull()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
rules.NewZoneIsCreated(new Cell(0, 0), null, map);
|
|
|
|
|
Assert.Empty(map.Zones);
|
|
|
|
|
}
|
|
|
|
@ -389,7 +389,7 @@ public class RulesTests
|
|
|
|
|
public void NewZoneIsCreated_DoesNothing_WhenFirstCellValueIsNull()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
Cell firstCell = new Cell(0, 0);
|
|
|
|
|
rules.NewZoneIsCreated(firstCell, new Cell(0, 1), map);
|
|
|
|
|
Assert.Empty(map.Zones);
|
|
|
|
@ -399,7 +399,7 @@ public class RulesTests
|
|
|
|
|
public void NewZoneIsCreated_DoesNothing_WhenSecondCellValueIsNull()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
Cell secondCell = new Cell(0, 0);
|
|
|
|
|
rules.NewZoneIsCreated(new Cell(0, 1), secondCell, map);
|
|
|
|
|
Assert.Empty(map.Zones);
|
|
|
|
@ -409,7 +409,7 @@ public class RulesTests
|
|
|
|
|
public void NewZoneIsCreated_CreatesNewZone_WhenBothCellsAreNotNullAndHaveValues()
|
|
|
|
|
{
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|
Map map = new Map("background");
|
|
|
|
|
Map map = new Map("test", "background");
|
|
|
|
|
Cell firstCell = new Cell(0, 0);
|
|
|
|
|
firstCell.Value = 1;
|
|
|
|
|
Cell secondCell = new Cell(0, 1);
|
|
|
|
|