Example #1
0
        public async Task CreateRole()
        {
            var roleName = Util.Methods.MakeString();
            var role     = new CB.CloudRole(roleName);
            var response = await role.SaveAsync();

            if (response != null)
            {
                Assert.IsTrue(true);
            }
        }
Example #2
0
        public async Task createRoleWithVerison()
        {
            var roleName1 = "Admin";
            var role      = new CB.CloudRole(roleName1);

            role = (CB.CloudRole) await role.SaveAsync();

            if ((int)role.Get("_version") >= 0)
            {
                Assert.IsTrue(true);
            }

            Assert.IsFalse(true);
        }
Example #3
0
        public async Task CreateRoleWithVerison()
        {
            var roleName1 = CB.Test.Util.Methods.MakeEmail();
            var role      = new CB.CloudRole(roleName1);

            role = (CB.CloudRole) await role.SaveAsync();

            if (Int32.Parse(role.Get("_version").ToString()) >= 0)
            {
                Assert.IsTrue(true);
            }
            else
            {
                Assert.IsFalse(true);
            }
        }
Example #4
0
        public async Task assignRoleToUser()
        {
            var roleName = Util.Methods._makeString();
            var role     = new CB.CloudRole(roleName);

            role.Set("name", roleName);
            var obj = new CB.CloudUser();

            obj.Set("username", username);
            obj.Set("password", password);
            await obj.Login();

            await role.SaveAsync();

            await obj.AddToRole(role);

            Assert.IsTrue(true);
        }
Example #5
0
        public async Task AssignRoleToUser()
        {
            var roleName = Util.Methods.MakeString();
            var role     = new CB.CloudRole(roleName);

            role.Set("name", roleName);
            var obj = new CB.CloudUser();

            obj.Set("username", CB.Test.Util.Methods.MakeEmail());
            obj.Set("password", CB.Test.Util.Methods.MakeEmail());
            obj.Set("email", CB.Test.Util.Methods.MakeEmail());
            await obj.SignupAsync();

            await role.SaveAsync();

            await obj.AddToRoleAsync(role);

            Assert.IsTrue(true);
        }
Example #6
0
        public async Task RetrieveRole()
        {
            var roleName = Util.Methods.MakeString();
            var role     = new CB.CloudRole(roleName);
            var response = await role.SaveAsync();

            if (response.ID == null)
            {
                Assert.IsTrue(true);
            }
            var query = new CB.CloudQuery("Role");

            query.EqualTo("id", response.ID);
            var result = await query.FindAsync();

            if (result == null)
            {
                Assert.Fail("Should retrieve the cloud role");
            }
            Assert.IsTrue(true);
        }