public void ValidPassports() { var passports = PassportUtils.ParsePassports(_validPassports).ToList(); passports .ForEach(p => p.IsValidComplexChecks().Should().BeTrue()); }
public void BasicChecks() { var passports = PassportUtils.ParsePassports(_lines).ToList(); passports[0].IsValidBasicChecks().Should().Be(true); passports[1].IsValidBasicChecks().Should().Be(false); passports[2].IsValidBasicChecks().Should().Be(true); passports[3].IsValidBasicChecks().Should().Be(false); }
public void ParsePassport() { var passportString = new[] { _lines[0], _lines[1] }; var passport = PassportUtils.ParsePassport(passportString); passport.ecl.Should().Be("gry"); passport.pid.Should().Be("860033327"); passport.eyr.Should().Be("2020"); passport.hcl.Should().Be("#fffffd"); passport.byr.Should().Be("1937"); passport.iyr.Should().Be("2017"); passport.cid.Should().Be("147"); passport.hgt.Should().Be("183cm"); }
public void FieldsMustBeValid() { PassportUtils.IsHeight("60in").Should().BeTrue(); PassportUtils.IsHeight("190cm").Should().BeTrue(); PassportUtils.IsHeight("190in").Should().BeFalse(); PassportUtils.IsHeight("190").Should().BeFalse(); PassportUtils.IsHexColor("#123abc").Should().BeTrue(); PassportUtils.IsHexColor("#123abz").Should().BeFalse(); PassportUtils.IsHexColor("123abc").Should().BeFalse(); PassportUtils.IsEyesColor("brn").Should().BeTrue(); PassportUtils.IsEyesColor("wat").Should().BeFalse(); PassportUtils.IsPid("000000001").Should().BeTrue(); PassportUtils.IsPid("0123456789").Should().BeFalse(); }
public void ParseSeveralPassports() { var passports = PassportUtils.ParsePassports(_lines); passports.Should().HaveCount(4); }