public void Day7_PopulateChildLists() { var input = "fwft (72) -> ktlj, cntj, xhth"; var day = new Day7(); var exe = new Executable { Name = "fwft", Entry = input }; var executables = new List <Executable>(new[] { exe, new Executable { Name = "ktlj", Entry = "ktlj (57)" }, new Executable { Name = "cntj", Entry = "cntj (57)" }, new Executable { Name = "xhth", Entry = "xhth (57)" }, }); day.PopulateChildLists(executables); exe.Children.Count.ShouldBe(3); exe.Children.ShouldContain(c => c.Name == "ktlj"); exe.Children.ShouldContain(c => c.Name == "cntj"); exe.Children.ShouldContain(c => c.Name == "xhth"); }
public void Day7_PopulateChildListsWithThreeLevels() { var day = new Day7(); var executables = new List <Executable>(new[] { new Executable { Name = "fwft", Entry = "fwft (72) -> ktlj" }, new Executable { Name = "ktlj", Entry = "ktlj (57) -> cntj" }, new Executable { Name = "cntj", Entry = "cntj (57) -> xhth" }, new Executable { Name = "xhth", Entry = "xhth (57)" }, }); day.PopulateChildLists(executables); executables[0].Children.Count.ShouldBe(1); executables[0].Children.ShouldContain(c => c.Name == "ktlj"); executables[1].Children.Count.ShouldBe(1); executables[1].Children.ShouldContain(c => c.Name == "cntj"); executables[2].Children.Count.ShouldBe(1); executables[2].Children.ShouldContain(c => c.Name == "xhth"); executables[3].Children.Count.ShouldBe(0); }