public void Parsing_CreatesAllBags()
        {
            var bags = Problem7.ParseInput(_testInputOne);

            Assert.AreEqual(9, bags.Count);
            Assert.IsTrue(bags.Any(bag => bag.Value.Color.Equals("vibrant plum")));
            Assert.IsFalse(bags.Any(bag => bag.Value.Color.Equals("bright yellow")));
        }
        public void FindBagsInsideGoldenBag()
        {
            var bags = Problem7.ParseInput(_testInputOne);

            Assert.AreEqual(32, Problem7.FindBagsWithinShinyGoldBag(bags));

            var moreBags = Problem7.ParseInput(_testInputTwo);

            Assert.AreEqual(126, Problem7.FindBagsWithinShinyGoldBag(moreBags));
        }
        public void Parsing_BagsContainCorrect()
        {
            var bags = Problem7.ParseInput(_testInputOne);

            var lightRedBag = bags.First(b => b.Value.Color.Equals("light red")).Value;

            Assert.AreEqual(1, lightRedBag.Children.First(b => b.Item1.Color.Equals("bright white")).Item1.Children.Count);
            Assert.AreEqual(2, lightRedBag.Children.First(b => b.Item1.Color.Equals("muted yellow")).Item1.Children.Count);

            Assert.AreEqual(0, bags.First(b => b.Value.Color.Equals("faded blue")).Value.Children.Count);
        }
Example #4
0
        public void ParseInputTest()
        {
            var dependencies = Problem7.ParseInput(TestInput);

            Assert.AreEqual(1, dependencies['A'].Count);
            Assert.AreEqual(3, dependencies['E'].Count);

            Assert.AreEqual('C', dependencies['A'][0]);

            Assert.IsTrue(dependencies.ContainsKey('C'));

            Assert.IsTrue(dependencies['E'].Contains('B'));
            Assert.IsTrue(dependencies['E'].Contains('D'));
            Assert.IsFalse(dependencies['E'].Contains('A'));
        }
        public void FindGoldenBagPossibilities()
        {
            var bags = Problem7.ParseInput(_testInputOne);

            Assert.AreEqual(4, Problem7.FindBagsThatCanHoldShinyGoldBag(bags));
        }
Example #6
0
        public void DetermineAssemblyTimeTest()
        {
            var dependencies = Problem7.ParseInput(TestInput);

            Assert.AreEqual(15, Problem7.DetermineAssemblyTime(dependencies, 0, 2));
        }
Example #7
0
        public void FindAssemblyOrderTest()
        {
            var dependencies = Problem7.ParseInput(TestInput);

            Assert.AreEqual("CABDFE", Problem7.FindAssemblyOrder(dependencies));
        }