public void CreateUserWithPassword_AsString(string userName, string password, string expected) { var statement = new CreateUserStatement(userName, new PasswordIdentificationInfo(password)); var sql = statement.ToSqlString(); Assert.Equal(expected, sql); }
public async void AdminCreatesUserWithPassword(string user, string password) { var statement = new CreateUserStatement(user, new PasswordIdentificationInfo(password)); var result = await statement.ExecuteAsync(adminContext); Assert.NotNull(result); Assert.True(result.IsEmpty()); Assert.Equal(user, createdUser); }
public async void CreateWithInvalidName(string user, string password) { var statement = new CreateUserStatement(user, new PasswordIdentificationInfo(password)); var result = await statement.ExecuteAsync(adminContext); Assert.NotNull(result); Assert.True(result.IsError()); Assert.IsType <SqlStatementException>(result.Error()); }
protected override SqlStatement VisitCreateUser(CreateUserStatement statement) { builder.AppendFormat("CREATE USER {0}", statement.UserName); if (statement.Password != null) { builder.AppendFormat(" IDENTIFIED BY PASSWORD {0}", statement.Password); } return(base.VisitCreateUser(statement)); }
public void WithSimplePassword() { const string userName = "******"; var password = SqlExpression.Constant(DataObject.VarChar("12345")); var statement = new CreateUserStatement(userName, password); statement.Execute(Query); var exists = Query.UserExists(userName); Assert.IsTrue(exists); }
protected virtual SqlStatement VisitCreateUser(CreateUserStatement statement) { return new CreateUserStatement(statement.UserName, statement.Identifier); }
protected override SqlStatement VisitCreateUser(CreateUserStatement statement) { builder.AppendFormat("CREATE USER {0}", statement.UserName); if (statement.Password != null) builder.AppendFormat(" IDENTIFIED BY PASSWORD {0}", statement.Password); return base.VisitCreateUser(statement); }
public async void UserCreatesOtherUser(string user, string password) { var statement = new CreateUserStatement(user, new PasswordIdentificationInfo(password)); await Assert.ThrowsAsync <UnauthorizedAccessException>(() => statement.ExecuteAsync(userContext)); }
protected virtual SqlStatement VisitCreateUser(CreateUserStatement statement) { return(new CreateUserStatement(statement.UserName, statement.Identifier)); }