public void Parse_bag_contents_rules_separated_by_new_line( string bagContentsRulesDescription, int expectedBagContentsRulesCount) { //When var bagContentsRulesCount = BagContentsRulesParser .Parse(bagContentsRulesDescription) .Count(); //Then Assert.Equal(expectedBagContentsRulesCount, bagContentsRulesCount); }
public void Sum_individual_bags_required_inside_a_single_shiny_gold_bag( string bagContentsRulesDescription, int expectedBagColorsCount) { //Given var bagContentsRules = BagContentsRulesParser.Parse(bagContentsRulesDescription); var shinyGoldBag = new Bag("shiny gold"); //When var requiredBagsCount = bagContentsRules .SumRequiredBagsFor(shinyGoldBag); //Then Assert.Equal(expectedBagColorsCount, requiredBagsCount); }
public void Count_bag_colors_who_contain_at_least_one_shiny_gold_bag( string bagContentsRulesDescription, int expectedBagColorsCount) { //Given var bagContentsRules = BagContentsRulesParser.Parse(bagContentsRulesDescription); var shinyGoldBag = new Bag("shiny gold"); //When var bagColorsCount = bagContentsRules .GetBagsContaining(shinyGoldBag) .Select(bag => bag.Color) .Distinct() .Count(); //Then Assert.Equal(expectedBagColorsCount, bagColorsCount); }