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));
        }
 public SmsVerificationController(IOptions <AppSettings> appSettings, IMemoryCache cache)
 {
     _appSettings           = appSettings.Value;
     _smsVerificationHelper = new SmsVerificationHelper(cache, _appSettings);
 }