Ejemplo n.º 1
0
        public IEnumerator <object[]> GetEnumerator()
        {
            var nodes1 = new Dictionary <string, int>()
            {
                ["node2"] = 1, ["node3"] = 3
            };
            var nodes2 = new Dictionary <string, int>()
            {
                ["node4"] = 2
            };

            var graph1 = PuzzleDay7GraphMock.SetUpGraphMock(nodes1, "node1").Object;
            var graph2 = PuzzleDay7GraphMock.SetUpGraphMock(nodes2, "node2").Object;

            yield return(new object[] {
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1.Name] = graph1,
                    [graph2.Name] = graph2
                },
                "node2", 1
            });

            yield return(new object[] {
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1.Name] = graph1,
                    [graph2.Name] = graph2
                },
                "node4", 2
            });
        }
        public IEnumerator <object[]> GetEnumerator()
        {
            var nodes1 = new Dictionary <string, int>()
            {
                ["node1"] = 1,
                ["node2"] = 1,
                ["node3"] = 1
            };
            var nodes1a = new Dictionary <string, int>()
            {
                ["node3"] = 1,
                ["node4"] = 1,
                ["node4"] = 1
            };

            var nodes1b = new Dictionary <string, int>()
            {
                ["node1"] = 1,
                ["node2"] = 1,
                ["node3"] = 1,
                ["node4"] = 1
            };
            var graph1 = PuzzleDay7GraphMock.SetUpGraphMock(nodes1, "node1").Object;
            var graph2 = PuzzleDay7GraphMock.SetUpGraphMock(nodes1, "node2").Object;

            var graph1a = PuzzleDay7GraphMock.SetUpGraphMock(nodes1a, "node1").Object;
            var graph1b = PuzzleDay7GraphMock.SetUpGraphMock(nodes1b, "node1").Object;


            yield return(new object[] {
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1.Name] = graph1
                },
                graph2,
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1.Name] = graph1,
                    [graph2.Name] = graph2
                },
            });

            yield return(new object[] {
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1.Name] = graph1
                },
                graph1a,
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1b.Name] = graph1b
                },
            });
        }
        public IEnumerator <object[]> GetEnumerator()
        {
            var input = "vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.";
            var graph = PuzzleDay7GraphMock.SetUpGraphMock(new Dictionary <string, int>()
            {
                ["faded blue"] = 5, ["dotted black"] = 6
            }, "vibrant plum").Object;

            var input2 = "dotted black bags contain no other bags.";
            var graph2 = PuzzleDay7GraphMock.SetUpGraphMock(new Dictionary <string, int>(), "dotted black").Object;


            yield return(new object[] { input, graph });

            yield return(new object[] { input2, graph2 });
        }
Ejemplo n.º 4
0
        public IEnumerator <object[]> GetEnumerator()
        {
            var nodes1 = new Dictionary <string, int>()
            {
                ["node2"] = 2, ["node4"] = 2
            };
            var nodes2 = new Dictionary <string, int>()
            {
                ["node3"] = 5
            };
            var nodes3 = new Dictionary <string, int>()
            {
                ["node4"] = 3
            };
            var nodes4 = new Dictionary <string, int>()
            {
            };

            var graph1 = PuzzleDay7GraphMock.SetUpGraphMock(nodes1, "searchedNode").Object;
            var graph2 = PuzzleDay7GraphMock.SetUpGraphMock(nodes2, "node2").Object;
            var graph3 = PuzzleDay7GraphMock.SetUpGraphMock(nodes3, "node3").Object;
            var graph4 = PuzzleDay7GraphMock.SetUpGraphMock(nodes4, "node4").Object;

            yield return(new object[] {
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1.Name] = graph1,
                    [graph2.Name] = graph2,
                    [graph3.Name] = graph3,
                    [graph4.Name] = graph4
                },
                graph1.Name, 1 + 2 + 2 * (1 + 5 * (1 + 3 * (1)))
            });

            yield return(new object[] {
                new Dictionary <string, GraphNodeDay7>()
                {
                    [graph1.Name] = graph1
                },
                graph1.Name, 1
            });
        }