public void Longest_Method() { var generator = new PathGenerator(_map, _rules); Path actualPath = generator.Longest(); Assert.That(actualPath.Length, Is.EqualTo(_paths[_longestPathIndex].Length), "Longest path.Length"); Assert.That(generator._rowCount, Is.EqualTo(_paths.Length), "Found paths.Length"); for (int i = 0; i < actualPath.Length; i++) { Pillar actualPosition = actualPath.GetByIndex(i); Pillar expectedPosition = _paths[_longestPathIndex].GetByIndex(i); if (!actualPosition.Equals(expectedPosition)) { Assert.Fail($"Position at index {i} does not match!" + $"{actualPosition.X} != {expectedPosition.X} || " + $"{actualPosition.Y} != {expectedPosition.Y} ||" + $"{actualPosition.Height} != {expectedPosition.Height}"); } } }
private void RemoveWrongDirection(Pillar[] fields, Pillar oldPosition) { Log.Debug($"RemoveWrongDirection(Length: {fields.Length}, ({oldPosition.X}; {oldPosition.Y}))", 1); int index = 0; for (int i = 0; i < fields.Length; i++) { Pillar pillar = fields[i]; if (pillar != null && !pillar.Equals(oldPosition)) { fields[index] = pillar; Log.Debug($"Stayed: ({fields[index].X}; {fields[index].Y})"); index++; } } _count = index; Log.Debug(-1, $"RemoveWrongDirection() END"); }