public static string ValidateAadhaarNumber(string aadhaarNumber, string argumentName) { if (!string.IsNullOrEmpty(aadhaarNumber) && !AadhaarHelper.ValidateAadhaarNumber(aadhaarNumber)) { throw new ArgumentException(InvalidAadhaarNumber, argumentName); } return(aadhaarNumber); }
public void ValidateAadhaarNumberTest() { var inside = new[] { "999999999999" }; var outside = new[] { null, string.Empty, "999999999990", "9999 9999 9999" }; // Valid Tests. foreach (var aadhaarNumber in inside) { Assert.True(AadhaarHelper.ValidateAadhaarNumber(aadhaarNumber)); } // Invalid Tests. foreach (var aadhaarNumber in outside) { Assert.False(AadhaarHelper.ValidateAadhaarNumber(aadhaarNumber)); } }