Esempio n. 1
0
        public async void AdminRevokesRoleFromUser(string user, string role)
        {
            var statement = new RevokeRoleStatement(user, role);
            var result    = await statement.ExecuteAsync(adminContext);

            Assert.NotNull(result);
            Assert.True(result.IsEmpty());
            Assert.Equal(user, revokedUser);
            Assert.Equal(role, revokedRole);
        }
Esempio n. 2
0
        public void RevokeRole_AsString(string user, string role, string expected)
        {
            var statement = new RevokeRoleStatement(user, role);

            Assert.Equal(expected, statement.ToSqlString());
        }
Esempio n. 3
0
        public async void UserRevokesOtherUserRole(string user, string role)
        {
            var statement = new RevokeRoleStatement(user, role);

            await Assert.ThrowsAsync <UnauthorizedAccessException>(() => statement.ExecuteAsync(userContext));
        }
        public void RevokeRole()
        {
            var statement = new RevokeRoleStatement("user1", "role1");

            SerializeAndAssert(statement, (serialized, deserialized) => {
                Assert.IsNotNull(deserialized);
                Assert.AreEqual("user1", deserialized.Grantee);
                Assert.AreEqual("role1", deserialized.RoleName);
                Assert.IsFalse(deserialized.Admin);
            });
        }