Exemplo n.º 1
0
        public void CellDeleted_GetReturnsNull()
        {
            var cell1 = new GridMapCell();
            var map   = new GridMap(4, 5);

            map.AddOrUpdate(3, 4, cell1);
            map.Delete(3, 4);

            Assert.That(map.Get(3, 4), Is.Null);
        }
Exemplo n.º 2
0
        public void CellAdded_GetReturnsAddedValue()
        {
            var cell1 = new GridMapCell();
            var cell2 = new GridMapCell();
            var map   = new GridMap(4, 5);

            map.AddOrUpdate(3, 4, cell1);
            map.AddOrUpdate(0, 0, cell2);

            Assert.That(cell1, Is.EqualTo(map.Get(3, 4)));
            Assert.That(cell2, Is.EqualTo(map.Get(0, 0)));
        }
Exemplo n.º 3
0
 private bool DoesConnect(LineEntity line, GridMapCell leftCell, GridMapCell rightCell)
 {
     return((line.FirstEnd == leftCell.Id || line.FirstEnd == rightCell.Id) &&
            (line.SecondEnd == leftCell.Id || line.SecondEnd == rightCell.Id));
 }
Exemplo n.º 4
0
 private bool AreConnected(GridMapCell leftCell, GridMapCell rightCell)
 {
     return(leftCell.Lines.Any(line => DoesConnect(line, leftCell, rightCell)) ||
            rightCell.Lines.Any(line => DoesConnect(line, leftCell, rightCell)));
 }
Exemplo n.º 5
0
 private bool IsPowerEntity(GridMapCell cell)
 {
     return(cell?.Id != null);
 }