public void PasswordShouldValidateBeforeExpiry()
        {
            var otp = new OneTimePassword(this.userId, "testPassword");
            passwordStoreMoq.Setup(x => x.Read(this.userId)).Returns(otp);

            var oneTimePasswordService = new OneTimePasswordService(this.passwordStoreMoq.Object, this.configurationMoq.Object);
            var password = oneTimePasswordService.Generate(userId);
            if (!oneTimePasswordService.Validate(this.userId, otp.Password)) Assert.Fail("Password should have validated.");
        }
        public void Write(string userId, string password)
        {
            if (string.IsNullOrEmpty(userId)) throw new ArgumentNullException("userId");
            if (string.IsNullOrEmpty(password)) throw new ArgumentNullException("password");

            var newPassword = new OneTimePassword(userId, password);

            if (this.store.ContainsKey(userId)) this.store.Remove(userId);

            this.store.Add(userId, newPassword);
        }