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); }
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))); }
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)); }
private bool AreConnected(GridMapCell leftCell, GridMapCell rightCell) { return(leftCell.Lines.Any(line => DoesConnect(line, leftCell, rightCell)) || rightCell.Lines.Any(line => DoesConnect(line, leftCell, rightCell))); }
private bool IsPowerEntity(GridMapCell cell) { return(cell?.Id != null); }