public virtual void testNewTaskOwner()
        {
            // given
            MyResourceAuthorizationProvider.ClearProperties();

            createGrantAuthorization(Resources.Task, AuthorizationFields.Any, Permissions.All, userId);

            string taskId  = "myTask";
            ITask  NewTask = taskService.NewTask(taskId);

            taskService.SaveTask(NewTask);

            // when (1)
            taskService.SetOwner(taskId, "demo");

            // then (1)
            Assert.IsNull(MyResourceAuthorizationProvider.OldOwner);
            Assert.AreEqual("demo", MyResourceAuthorizationProvider.NewOwner);

            MyResourceAuthorizationProvider.ClearProperties();

            // when (2)
            taskService.SetOwner(taskId, userId);

            // then (2)
            Assert.AreEqual("demo", MyResourceAuthorizationProvider.OldOwner);
            Assert.AreEqual(userId, MyResourceAuthorizationProvider.NewOwner);

            taskService.DeleteTask(taskId, true);
        }
        public virtual void testAddGroupIdentityLink()
        {
            // given
            MyResourceAuthorizationProvider.ClearProperties();

            createGrantAuthorization(Resources.Task, AuthorizationFields.Any, Permissions.All, userId);

            string taskId  = "myTask";
            ITask  NewTask = taskService.NewTask(taskId);

            taskService.SaveTask(NewTask);

            // when
            taskService.AddGroupIdentityLink(taskId, "management", "myIdentityLink");

            // then
            Assert.AreEqual("myIdentityLink", MyResourceAuthorizationProvider.AddGroupIdentityLinkType);
            Assert.AreEqual("management", MyResourceAuthorizationProvider.AddGroupIdentityLinkGroup);

            taskService.DeleteTask(taskId, true);
        }
        public virtual void testAddCandidateUser()
        {
            // given
            MyResourceAuthorizationProvider.ClearProperties();

            createGrantAuthorization(Resources.Task, AuthorizationFields.Any, Permissions.All, userId);

            string taskId  = "myTask";
            ITask  NewTask = taskService.NewTask(taskId);

            taskService.SaveTask(NewTask);

            // when
            taskService.AddCandidateUser(taskId, "demo");

            // then
            Assert.AreEqual(IdentityLinkType.Candidate, MyResourceAuthorizationProvider.AddUserIdentityLinkType);
            Assert.AreEqual("demo", MyResourceAuthorizationProvider.AddUserIdentityLinkUser);

            taskService.DeleteTask(taskId, true);
        }