public void ValidateCheckDigit_ShouldReturnFalse_NonSedol() { var result = sedolValidationHelper.ValidateCheckDigit("12"); Assert.AreEqual(result, false); result = sedolValidationHelper.ValidateCheckDigit(null); Assert.AreEqual(result, false); }
/// <summary> /// Validates the sedol according to the set of ruls /// </summary> /// <param name="input"></param> /// <returns> ISedolValidationResult with the assigned respecitve properties</returns> public ISedolValidationResult ValidateSedol(string input) { ISedolValidationResult validationResult; bool isUserDefined = false; try { Tuple <bool, string> isValidInput = validationHelper.ValidateInputstring(input); if (isValidInput.Item1) { isUserDefined = validationHelper.CheckUserDefined(input); bool isValidChkDigit = validationHelper.ValidateCheckDigit(input); if (!isValidChkDigit) { isValidInput = new Tuple <bool, string>(false, Constants.ErrInvalidCheckSum); } else { isValidInput = new Tuple <bool, string>(true, null); } } validationResult = new SedolValidationResult(input, isValidInput.Item1, isUserDefined, isValidInput.Item2); return(validationResult); } catch { //Fallback method - Not included in scope return(new SedolValidationResult(input, false, isUserDefined, Constants.ErrInvalidChar)); } }