public virtual void shouldNotInitIfAlreadySet()
        {
            TestProcessEngineCfg testProcessEngineCfg = new TestProcessEngineCfg();

            // given
            testProcessEngineCfg.DefaultUserPermissionForTask = Permissions.All;

            // if
            testProcessEngineCfg.InitDefaultUserPermissionForTask();

            // then
            Assert.AreEqual(Permissions.All, testProcessEngineCfg.DefaultUserPermissionForTask);
        }
        public virtual void shouldInitTaskWorkPermission()
        {
            TestProcessEngineCfg testProcessEngineCfg = new TestProcessEngineCfg();

            // given
            testProcessEngineCfg.DefaultUserPermissionNameForTask = "TASK_WORK";

            // if
            testProcessEngineCfg.InitDefaultUserPermissionForTask();

            // then
            Assert.AreEqual(Permissions.TaskWork, testProcessEngineCfg.DefaultUserPermissionForTask);
        }
        public virtual void shouldInitUpdatePermission()
        {
            TestProcessEngineCfg testProcessEngineCfg = new TestProcessEngineCfg();

            // given
            testProcessEngineCfg.DefaultUserPermissionNameForTask = "Permissions.Update";

            // if
            testProcessEngineCfg.InitDefaultUserPermissionForTask();

            // then
            Assert.AreEqual(Permissions.Update, testProcessEngineCfg.DefaultUserPermissionForTask);
        }
        public virtual void shouldThrowExceptionOnNullPermissionName()
        {
            TestProcessEngineCfg testProcessEngineCfg = new TestProcessEngineCfg();

            // given
            testProcessEngineCfg.DefaultUserPermissionNameForTask = null;

            // if
            try
            {
                testProcessEngineCfg.InitDefaultUserPermissionForTask();
                Assert.Fail("Exception expected");
            }
            catch (ProcessEngineException e)
            {
                string expectedExceptionMessage = "Invalid value 'null' for configuration property 'defaultUserPermissionNameForTask'.";
                //Assert.That(e.Message, containsString(expectedExceptionMessage));
                Assert.That(e.Message, Does.Contain(expectedExceptionMessage));
            }
        }
        public virtual void shouldThrowExceptionOnUnsupportedPermission()
        {
            TestProcessEngineCfg testProcessEngineCfg = new TestProcessEngineCfg();

            // given
            testProcessEngineCfg.DefaultUserPermissionNameForTask = "UNSUPPORTED";

            // if
            try
            {
                testProcessEngineCfg.InitDefaultUserPermissionForTask();
                Assert.Fail("Exception expected");
            }
            catch (ProcessEngineException e)
            {
                string expectedExceptionMessage = string.Format("Invalid value '{0}' for configuration property 'defaultUserPermissionNameForTask'.", "UNSUPPORTED");
                //Assert.That(e.Message, containsString(expectedExceptionMessage));
                Assert.That(e.Message, Does.Contain(expectedExceptionMessage));
            }
        }