示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBuiltinFunctionMapperRegistration()
        public virtual void testBuiltinFunctionMapperRegistration()
        {
            // given a process engine configuration with a custom function mapper
            ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda" + this.GetType().Name);

            CustomExpressionManager customExpressionManager = new CustomExpressionManager();

            Assert.assertTrue(customExpressionManager.FunctionMappers.Count == 0);
            config.ExpressionManager = customExpressionManager;

            // when the engine is initialized
            engine = config.buildProcessEngine();

            // then two default function mappers should be registered
            Assert.assertSame(customExpressionManager, config.ExpressionManager);
            Assert.assertEquals(2, customExpressionManager.FunctionMappers.Count);

            bool commandContextMapperFound = false;
            bool dateTimeMapperFound       = false;

            foreach (FunctionMapper functionMapper in customExpressionManager.FunctionMappers)
            {
                if (functionMapper is CommandContextFunctionMapper)
                {
                    commandContextMapperFound = true;
                }

                if (functionMapper is DateTimeFunctionMapper)
                {
                    dateTimeMapperFound = true;
                }
            }

            Assert.assertTrue(commandContextMapperFound && dateTimeMapperFound);
        }