public async Task CheckCreateRoleAsync(string areaId, string accountId, string possibleRoleId)
        {
            Role    role    = new Role();
            Account account = await accountProvider.GetById(accountId);

            Area area = await areaProvider.GetByIdAsync(areaId);

            PossibleRole possibleRole = await possibleRoleProvider.GetByIdAsync(possibleRoleId);

            role.Account     = account;
            role.DefaultRole = possibleRole;
            role.Context     = area;

            var created = await roleProvider.CreateRoleAsync(role);

            Assert.NotNull(created);
            Assert.IsType <Role>(created);
            Assert.True(await roleProvider.RemoveRoleCreated(created.Id));
        }
Esempio n. 2
0
        public async Task CheckChangeAdminAsync(string newInCharge, string technologyId, string possibleroleid)
        {
            Account newAccount = await accountProvider.GetById(newInCharge);

            Technology technology = await technologyProvider.GetByIdAsync(technologyId);

            PossibleRole possibleRole = await possibleRoleProvider.GetByIdAsync(possibleroleid);

            Role newRole = new Role {
                Context = technology, Account = newAccount, DefaultRole = possibleRole
            };



            var changed = await technologyProvider.ChangeAdminAsync(newRole);

            Assert.IsType <Role>(changed);

            Assert.True(await roleProvider.RemoveRoleCreated(changed.Id));
            Assert.True(await roleProvider.ReviveRoleDeleted("147"));
        }
Esempio n. 3
0
        public async Task CheckChangeInchargeAsync(string oldInCharge, string newInCharge, string areaId, string possibleroleid)
        {
            Account newAccount = await accountProvider.GetById(newInCharge);

            Account oldAccount = await accountProvider.GetById(oldInCharge);

            Area area = await areaProvider.GetByIdAsync(areaId);

            PossibleRole possibleRole = await possibleRoleProvider.GetByIdAsync(possibleroleid);

            Role newRole = new Role {
                Context = area, Account = newAccount, DefaultRole = possibleRole
            };



            var changed = await areaProvider.ChangeInChargeAsync(newRole);

            Assert.IsType <Role>(changed);
            Assert.True(await roleProvider.RemoveRoleCreated(changed.Id));
            Assert.True(await roleProvider.ReviveRoleDeleted("136"));
        }