Example #1
0
        public object PartOne()
        {
            var rules            = GetRules();
            var messageValidator = new MessageValidator(rules);
            var messages         = GetMessages();

            return(messages.Count(m => messageValidator.IsValid(m)));
        }
Example #2
0
        public object PartTwo()
        {
            var rules = GetRules(s => s.Replace("8: 42", "8: 42 | 42 8")
                                 .Replace("11: 42 31", "11: 42 31 | 42 11 31"));
            var messageValidator = new MessageValidator(rules);
            var messages         = GetMessages();

            return(messages.Count(m => messageValidator.IsValid(m)));
        }