public void TestGetPathToRoot(string input, string from, string expectedResult) { var parser = new InputParser(input.Split(",")); parser.Parse(); InputParser.Dump(parser.Roots.First(), console.WriteLine); var r = string.Join(",", InputParser.GetPathToRootSpatialObject(parser.AllObjects[from]).Select(x => x.Name)); Assert.Equal(expectedResult, r); }
public void TestCalcTransferCount(string input, string from, string to, int expectedResult) { var parser = new InputParser(input.Split(",")); parser.Parse(); InputParser.Dump(parser.Roots.First(), console.WriteLine); console.WriteLine(string.Join(",", InputParser.GetPathToRootSpatialObject(parser.AllObjects[from]).Select(x => x.Name))); console.WriteLine(string.Join(",", InputParser.GetPathToRootSpatialObject(parser.AllObjects[to]).Select(x => x.Name))); var(degenerative, n) = parser.CalculateOrbitalTransfersCount(parser.AllObjects[from], parser.AllObjects[to], console.WriteLine); if (degenerative) { console.WriteLine("Degenerative case"); } Assert.Equal(expectedResult, n); }