public void Max_Should_Return_Max_Elements() { var array = new[] { 1, 2, 8, 9, 1, 4, 5, 5 }; MaxResult <int> result = array.Max(3); Assert.True(result.Max.Length == 3); Assert.Equal(9, result.Max[0]); Assert.Equal(8, result.Max[1]); Assert.Equal(5, result.Max[2]); }
static void Main(string[] args) { IGrid grid = new DistanceGrid(5, 5); new BinaryTree().Run(ref grid); var start = grid[0, 0]; Distances distances = start.Distances; var newStart = distances.Max.Cell; var distance = distances.Max.Distance; var newDistances = newStart.Distances; MaxResult result = newDistances.Max; DistanceGrid distanceGrid = (DistanceGrid)grid; distanceGrid.CellDistances = newDistances.PathToGoal(result.Cell); Console.WriteLine(distanceGrid.ToString(false)); Console.ReadKey(); }