Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEntryCriteria()
        public virtual void testEntryCriteria()
        {
            // given

            // create sentry containing ifPart
            Sentry sentry = createElement(casePlanModel, "Sentry_1", typeof(Sentry));
            IfPart ifPart = createElement(sentry, "abc", typeof(IfPart));
            ConditionExpression conditionExpression = createElement(ifPart, "def", typeof(ConditionExpression));

            conditionExpression.Text = "${test}";

            // set entryCriteria
            EntryCriterion criterion = createElement(planItem, typeof(EntryCriterion));

            criterion.Sentry = sentry;

            // transform casePlanModel as parent
            CmmnActivity parent = (new CasePlanModelHandler()).handleElement(casePlanModel, context);

            context.Parent = parent;

            // transform Sentry
            CmmnSentryDeclaration sentryDeclaration = (new SentryHandler()).handleElement(sentry, context);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            assertTrue(newActivity.ExitCriteria.Count == 0);

            assertFalse(newActivity.EntryCriteria.Count == 0);
            assertEquals(1, newActivity.EntryCriteria.Count);

            assertEquals(sentryDeclaration, newActivity.EntryCriteria[0]);
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMultipleEntryCriteria()
        public virtual void testMultipleEntryCriteria()
        {
            // given

            // create first sentry containing ifPart
            Sentry sentry1 = createElement(casePlanModel, "Sentry_1", typeof(Sentry));
            IfPart ifPart1 = createElement(sentry1, "abc", typeof(IfPart));
            ConditionExpression conditionExpression1 = createElement(ifPart1, "def", typeof(ConditionExpression));

            conditionExpression1.Text = "${test}";

            // set first entryCriteria
            EntryCriterion criterion1 = createElement(planItem, typeof(EntryCriterion));

            criterion1.Sentry = sentry1;

            // create first sentry containing ifPart
            Sentry sentry2 = createElement(casePlanModel, "Sentry_2", typeof(Sentry));
            IfPart ifPart2 = createElement(sentry2, "ghi", typeof(IfPart));
            ConditionExpression conditionExpression2 = createElement(ifPart2, "jkl", typeof(ConditionExpression));

            conditionExpression2.Text = "${test}";

            // set second entryCriteria
            EntryCriterion criterion2 = createElement(planItem, typeof(EntryCriterion));

            criterion2.Sentry = sentry2;

            // transform casePlanModel as parent
            CmmnActivity parent = (new CasePlanModelHandler()).handleElement(casePlanModel, context);

            context.Parent = parent;

            // transform Sentry
            CmmnSentryDeclaration firstSentryDeclaration  = (new SentryHandler()).handleElement(sentry1, context);
            CmmnSentryDeclaration secondSentryDeclaration = (new SentryHandler()).handleElement(sentry2, context);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            assertTrue(newActivity.ExitCriteria.Count == 0);

            assertFalse(newActivity.EntryCriteria.Count == 0);
            assertEquals(2, newActivity.EntryCriteria.Count);

            assertTrue(newActivity.EntryCriteria.Contains(firstSentryDeclaration));
            assertTrue(newActivity.EntryCriteria.Contains(secondSentryDeclaration));
        }