public void ImportDataAndSumDirectIndirectOrbitsTest() { string filePath = @"AdventOfCode2019/InputData/Day6Orbits.txt"; Day6UniversalOrbitMap map = new Day6UniversalOrbitMap(); IEnumerable <OrbitDesc> input = ReadInputFromFile.ReadFile(new FileInfo(filePath)); var head = new Node("COM"); head = map.AddListToGraph(head, input.ToList()); Assert.That(map.CountTotalOrbits(head), Is.EqualTo(234446)); }
public void ImportDataAndFindDistBetweenYouAndSanTest() { string filePath = @"AdventOfCode2019/InputData/Day6Orbits.txt"; IEnumerable <OrbitDesc> input = ReadInputFromFile.ReadFile(new FileInfo(filePath)); var head = new Node("COM"); Day6UniversalOrbitMap map = new Day6UniversalOrbitMap(); head = map.AddListToGraph(head, input.ToList()); var sanNode = map.FindNode(head, "SAN"); var distBetweenYouAndSan = map.CountDistanceBetweenPoints(sanNode, "YOU"); var distBetweenOrbitingBodies = distBetweenYouAndSan - 2; Assert.That(distBetweenOrbitingBodies, Is.EqualTo(385)); }