public void Test_VerifyCode() { // Arrange var verificationHelper = new SmsVerificationHelper(GetCache(), _appSettings); var testNumber = "+17075555555"; // Act var verificationCodeMsg = verificationHelper.GenerateMessageWithVerificationCode(testNumber); var verificationCodeRegEx = new Regex(@"[0-9]{6,}", RegexOptions.IgnoreCase); var verificationCode = verificationCodeRegEx.Match(verificationCodeMsg).Value; // Assert Assert.True(verificationHelper.VerifyCode(testNumber, verificationCode)); }
public void Test_GenerateMessageWithVerificationCode_should_contain_app_hash() { // Arrange var verificationHelper = new SmsVerificationHelper(GetCache(), _appSettings); var testNumber = "+17075555555"; var appHash = _appSettings.APP_HASH; // Act var message = verificationHelper.GenerateMessageWithVerificationCode(testNumber); var verificationCodeRegEx = new Regex(@"[0-9]{6,}", RegexOptions.IgnoreCase); // Assert Assert.True(message.IndexOf(appHash, StringComparison.Ordinal) > -1); Assert.True(verificationCodeRegEx.IsMatch(message)); }