public void Day19_MonsterMessages_NewParts_Ok()
        {
            var lines = DailyDataUtilities.ReadLinesFromFile("Day19Data.txt");

            Assert.Equal(634, lines.Length);

            var sut = new MonsterMessage(lines.Take(131).ToArray());

            Assert.Equal(131, sut.Rules.Count);
            sut.ReplaceRule("8: 42 | 42 8");
            sut.ReplaceRule("11: 42 31 | 42 11 31");

            sut.isPart2 = true;
            string exp42 = sut.MakeRegexForRule(42);

            Assert.NotEmpty(exp42);
            string exp31 = sut.MakeRegexForRule(31);

            Assert.NotEmpty(exp31);

            string exp8 = sut.MakeRegexForRule(8);

            Assert.NotEmpty(exp8);
            string exp11 = sut.MakeRegexForRule(11);

            Assert.NotEmpty(exp11);
        }
        public void Day19_MonsterMessages_Part2_Ok()
        {
            var lines = DailyDataUtilities.ReadLinesFromFile("Day19Data.txt");

            Assert.Equal(634, lines.Length);

            var sut = new MonsterMessage(lines.Take(131).ToArray());

            Assert.Equal(131, sut.Rules.Count);
            sut.ReplaceRule("8: 42 | 42 8");
            sut.ReplaceRule("11: 42 31 | 42 11 31");

            var messages = lines.Skip(132).Take(510).ToArray();

            Assert.Equal(502, messages.Length);

            sut.isPart2 = true;
            string exp = sut.MakeRegexForRule(0);

            int count = 0;

            foreach (var msg in messages)
            {
                var rg = Regex.Match(msg, exp);
                if (rg.Success)
                {
                    count++;
                }
            }
            Assert.Equal(414, count);
        }
        public void Day19_Example_WithNewRulesSingle_Ok(string msg, bool expected)
        {
            var lines = DailyDataUtilities.ReadLinesFromFile("Day19Part2DataExample.txt");

            Assert.Equal(47, lines.Length);

            var sut = new MonsterMessage(lines.Take(31).ToArray());

            Assert.Equal(31, sut.Rules.Count);
            sut.ReplaceRule("8: 42 | 42 8");
            sut.ReplaceRule("11: 42 31 | 42 11 31");

            sut.isPart2 = true;
            string exp = sut.MakeRegexForRule(0);

            var rg = Regex.Match(msg, exp);

            Assert.Equal(expected, rg.Success);
        }