示例#1
0
        public void Auth_DoNotPassUser()
        {
            UserValidation userValidation = this.CreateUserValidation();

            subServiceUserRepository.CheckUser("A", "B").Returns(false);

            Assert.Throws <UnauthorizedAccessException>(() => userValidation.Auth("A", "B"));
        }
示例#2
0
        public string Auth(string login, string password)
        {
            if (_serviceUserRepository.CheckUser(login, password))
            {
                var nToken = Path.GetRandomFileName();
                _tokens.Add(nToken);
                return(nToken);
            }

            throw new UnauthorizedAccessException();
        }