public void Auth_DoNotPassUser() { UserValidation userValidation = this.CreateUserValidation(); subServiceUserRepository.CheckUser("A", "B").Returns(false); Assert.Throws <UnauthorizedAccessException>(() => userValidation.Auth("A", "B")); }
public string Auth(string login, string password) { if (_serviceUserRepository.CheckUser(login, password)) { var nToken = Path.GetRandomFileName(); _tokens.Add(nToken); return(nToken); } throw new UnauthorizedAccessException(); }