public async Task<IHttpActionResult> Login(LoginAttempt loginAttempt)
        {
            if (loginAttempt == null || !_loginAttemptValidator.IsValid(loginAttempt))
            {
                return BadRequest("Details missing.");
            }

            var user = await _userRepository.GetAsync(loginAttempt.Username, loginAttempt.Password);

            var token = _jwtProvider.CreateJwt(user.Username, user.Role, _dateProvider.Now());

            return Ok(token);
        }
        public void Can_Validate_When_Username_And_Password_Are_Populated()
        {
            var loginAttempt = new LoginAttempt("TEST", "TEST");

            Assert.That(_loginAttemptValidator.IsValid(loginAttempt));
        }
        public void Can_Invalidate_For_Zero_Character_Username()
        {
            var loginAttempt = new LoginAttempt(string.Empty, "TEST");

            Assert.That(!_loginAttemptValidator.IsValid(loginAttempt));
        }
        public void Can_Invalidate_For_Zero_Character_Password()
        {
            var loginAttempt = new LoginAttempt("TEST", string.Empty);

            Assert.That(!_loginAttemptValidator.IsValid(loginAttempt));
        }
        public void Can_Invalidate_For_Missing_Username()
        {
            var loginAttempt = new LoginAttempt(null, "TEST");

            Assert.That(!_loginAttemptValidator.IsValid(loginAttempt));
        }
        public void Can_Invalidate_For_Missing_Password()
        {
            var loginAttempt = new LoginAttempt("TEST", null);

            Assert.That(!_loginAttemptValidator.IsValid(loginAttempt));
        }