Esempio n. 1
0
        public void Part2Test()
        {
            // Given
            var rules = new LuggageRuleSet(Input.GetLines(7).Select(x => new LuggageRule(x)));

            // When
            var count = rules.CountBags("shiny gold");

            // Then
            Assert.Equal(32, count);
        }
Esempio n. 2
0
        public void Part1Test()
        {
            // Given
            var rules = new LuggageRuleSet(Input.GetLines(7).Select(x => new LuggageRule(x)));

            // When
            var colors           = rules.Rules.Select(x => x.Color);
            var canHoldShinyGold = colors.Where(x => rules.CanEventuallyContain(x, "shiny gold"))
                                   .OrderBy(x => x);

            // Then
            Assert.Equal(new [] { "bright white", "dark orange", "light red", "muted yellow" }, canHoldShinyGold);
        }