public void DateOfBirthCrossCheck(string mrzLine2, DateTime compareDateOfBirth, bool expectedResult) { var model = new MrzLine2Model(mrzLine2); var result = model.Verify(dateOfBirth: compareDateOfBirth); Assert.AreEqual(expectedResult, result.DateOfBirthCrossChecked); }
public void NationalityCrossCheck(string mrzLine2, string compareNationality, bool expectedResult) { var model = new MrzLine2Model(mrzLine2); var result = model.Verify(nationality: compareNationality); Assert.AreEqual(expectedResult, result.NationalityCrossChecked); }
public void GenderCrossCheck(string mrzLine2, Constants.Gender?compareGender, bool expectedResult) { var model = new MrzLine2Model(mrzLine2); var result = model.Verify(gender: compareGender); Assert.AreEqual(expectedResult, result.GenderCrossChecked); }
public void PassportNumberCrossCheck(string mrzLine2, string comparePassportNumber, bool expectedResult) { var model = new MrzLine2Model(mrzLine2); var result = model.Verify(comparePassportNumber); Assert.AreEqual(expectedResult, result.PassportNumberCrossChecked); }
public void ExpirationDateCrossCheck(string mrzLine2, DateTime compareExpirationDate, bool expectedResult) { var model = new MrzLine2Model(mrzLine2); var result = model.Verify(expirationDate: compareExpirationDate); Assert.AreEqual(expectedResult, result.PassportExpirtaionDateCrossChecked); }
// POST: api/Passport public IHttpActionResult Post([FromBody] PassportVerificationInputDTO parameters) { if (!ModelState.IsValid) { var validationErrorReport = new System.Text.StringBuilder(); validationErrorReport.AppendLine("Invalid Passport Verification Input"); foreach (var inputParam in ModelState) { validationErrorReport.AppendLine(inputParam.Key); validationErrorReport.AppendLine($"Value: {inputParam.Value.Value}"); foreach (var modelError in inputParam.Value.Errors) { validationErrorReport.AppendLine($"Error: {modelError.ErrorMessage}"); } } ErrorLogService.LogWarning(validationErrorReport.ToString()); return(BadRequest(ModelState)); } var model = new MrzLine2Model(parameters.MrzLine2); return(Ok(model.Verify(parameters.PassportNumber, parameters.Nationality, parameters.DOB, parameters.Gender, parameters.ExpirationDate))); }
public void AllCheckDigitVerifyFail(string mrzLine2) { var model = new MrzLine2Model(mrzLine2); var result = model.Verify(); Assert.AreEqual(false, result.DateOfBirthCheckDigitValid); Assert.AreEqual(false, result.PassportExpirationDateCheckDigitValid); Assert.AreEqual(false, result.PassportNumberCheckDigitValid); Assert.AreEqual(false, result.PersonalNumberCheckDigitValid); Assert.AreEqual(false, result.FinalCheckDigitValid); }
// GET: api/Passport/5 public IHttpActionResult Get([FromUri] PassportVerificationInputDTO parameters) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var model = new MrzLine2Model(parameters.MrzLine2); return(Ok(model.Verify(parameters.PassportNumber, parameters.Nationality, parameters.DOB, parameters.Gender, parameters.ExpirationDate))); }