Пример #1
0
		public void IsSessionActive_should_return_false_if_session_is_expired()
		{
			var resetPassword = new ResetPassword() { Created = DateTime.Now.AddDays(-1), SessionId = _sessionId, Email = "*****@*****.**" };
			_usersManagement.GetResetPasswordSession(Arg.Is<String>(_sessionId)).Returns(resetPassword);

			var result = _resetPasswordService.IsSessionActive(_sessionId);
			result.Should().BeFalse();
		}
Пример #2
0
		public void RemovePasswordSession(ResetPassword model)
		{
			if (model == null)
				throw new ArgumentNullException("model");

			_resetPasswordRepository.Delete(model);
		}
Пример #3
0
		public string SetResetPasswordSession(string email)
		{
			if (string.IsNullOrWhiteSpace(email))
				throw new ArgumentNullException("email");

			var resetPassword = new ResetPassword();
			resetPassword.Email = email;
			resetPassword.UserId = _userRepository.GetByEmail(email).Id;

			_resetPasswordRepository.Add(resetPassword);

			return resetPassword.SessionId;
		}
Пример #4
0
		public void GetResetPasswordSession_should_return_reset_password_session_if_session_id_is_correct()
		{
			var resetPassword = new ResetPassword() { Email = "*****@*****.**", SessionId = Guid.NewGuid().ToString().Replace("-", "") };
			ResetPasswordRepository.GetBySessionId(resetPassword.SessionId).Returns(resetPassword);
			//act
			var result = Target.GetResetPasswordSession(resetPassword.SessionId);
			result.Should().NotBeNull().And.Be(resetPassword);
		}