Example #1
0
        static void Main(string[] args)
        {
            var input = File.ReadAllText("input.txt");

            var part1 = PassportParser.Parse(input).Count(x => x.IsValid());

            Console.WriteLine($"Result Part 1 - {part1}");

            var part2 = PassportParser.Parse(input).Count(x => x.IsValid2());

            Console.WriteLine($"Result Part 2 - {part2}");
        }
Example #2
0
        static void Main(string[] args)
        {
            var input = File.ReadAllText("input.txt");

            var passports = new PassportParser().ParsePassports(input);

            var passportValidatorPart1 = new PassportValidator(new []
            {
                new RequriedFieldsValidation()
            });

            Console.WriteLine(passportValidatorPart1.CountValid(passports));

            var passportValidatorPart2 = new PassportValidator(new IPassportValidation[]
            {
                new RequriedFieldsValidation(),
                new ValidValueValidation()
            });

            Console.WriteLine(passportValidatorPart2.CountValid(passports));
        }