Beispiel #1
0
        public void CheckPassportContainsObligatoryFieldsTest()
        {
            var passportFile      = "passport_testing.txt";
            var passportProcessor = new PassportProcessor(passportFile);

            Assert.AreEqual(2, passportProcessor.CountFieldComplete());
        }
Beispiel #2
0
        public void ParsePassportTest()
        {
            var passportFile      = "passport_testing.txt";
            var passportProcessor = new PassportProcessor(passportFile);

            Assert.AreEqual(4, passportProcessor.Passports.Count);
        }
Beispiel #3
0
        public void SetUp()
        {
            const string testData = @"ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
byr:1937 iyr:2017 cid:147 hgt:183cm

iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884
hcl:#cfa07d byr:1929

hcl:#ae17e1 iyr:2013
eyr:2024
ecl:brn pid:760753108 byr:1931
hgt:179cm

hcl:#cfa07d eyr:2025 pid:166559648
iyr:2011 ecl:brn hgt:59in";

            var mockPuzzleInput = new Mock <IPuzzleInput>();

            mockPuzzleInput.Setup(p => p.GetPuzzleInput(It.IsAny <string>())).Returns(testData);

            _passportProcessor = new PassportProcessor(mockPuzzleInput.Object, new Mock <IFieldValidationService>().Object);
        }
Beispiel #4
0
        public void CheckPassportValidityTest(string passportFile, int expectedValid)
        {
            var passportProcessor = new PassportProcessor(passportFile);

            Assert.AreEqual(expectedValid, passportProcessor.CountValid());
        }