public object PartOne() { var rules = GetRules(); var messageValidator = new MessageValidator(rules); var messages = GetMessages(); return(messages.Count(m => messageValidator.IsValid(m))); }
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))); }