public void Test_UserAuthorizeValidator_Valid()
        {
            var test = new Test();
            var authentication = MockRepository.GenerateMock<IAuthenticationService>();
            var userService = new FakeUserService();

            authentication.Stub(x => x.Authenticate(userService.GetBy(new Specification<User>()), test.Password)).Return(true);

            var validator = new UserAuthorizeValidator<Test>(x => x.EmailAddress, authentication, userService);
            var results = validator.Validate(new PropertyValidatorContext("test", test, test.Password, "Password"));

            Assert.IsEmpty(results.ToList());
        }
        public void Test_UserAuthorizeValidator_NotValid()
        {
            var test = new Test();
            var authentication = MockRepository.GenerateMock<IAuthenticationService>();
            var userService = new FakeUserService();

            authentication.Stub(x => x.Authenticate(userService.GetBy(new Specification<User>()), test.Password)).Return(false);

            var validator = new UserAuthorizeValidator<Test>(x => x.EmailAddress, authentication, userService);
            var results = validator.Validate(new PropertyValidatorContext("test", test, test.Password, "Password"));

            foreach (var result in results)
            {
                Assert.AreEqual(Errors.UserAuthenticationFailed, result.ErrorMessage);
            }
        }