public void Give_passeport_fields_separate_by_spaces_or_newlines( int passportNumber, int expectedPassportFieldsCount) { //Given const string batchFileDescription = BatchFileDescription.PartOneExampleDescription; //When var passportFieldsCount = PassportParser.ParsePassportDescription( PassportParser .ParseBatchFile(batchFileDescription) .ElementAt(passportNumber)) .Count(); //Then Assert.Equal(expectedPassportFieldsCount, passportFieldsCount); }
public static int CountValidPassports(string batchFileDescription) => PassportParser .ParseBatchFile(batchFileDescription) .Select(PassportFactory.Create) .Count(passport => passport.ContainsAllRequiredFields());