public async void UserGrantsToOtherUser(string user, string objName, string privs, bool withOption) { var statement = new GrantObjectPrivilegesStatement(user, SqlPrivileges.Resolver.ResolvePrivilege(privs), ObjectName.Parse(objName), withOption, new string[0]); await Assert.ThrowsAsync <UnauthorizedAccessException>(() => statement.ExecuteAsync(userContext)); }
public async void AdminGrantsToUser(string user, string objName, string privs, bool withOption) { var statement = new GrantObjectPrivilegesStatement(user, SqlPrivileges.Resolver.ResolvePrivilege(privs), ObjectName.Parse(objName), withOption, new string[0]); var result = await statement.ExecuteAsync(adminContext); Assert.NotNull(result); Assert.True(result.IsEmpty()); Assert.Equal(adminContext.User().Name, grant.Granter); Assert.Equal(user, grant.Grantee); Assert.Equal(objName, grant.ObjectName.FullName); Assert.Equal(privs, grant.Privileges.ToString(SqlPrivileges.Resolver)); Assert.Equal(withOption, grant.WithOption); }