Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMultipleExitCriteria()
        public virtual void testMultipleExitCriteria()
        {
            // 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 exitCriteria
            ExitCriterion criterion1 = createElement(casePlanModel, typeof(ExitCriterion));

            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 exitCriteria
            ExitCriterion criterion2 = createElement(casePlanModel, typeof(ExitCriterion));

            criterion2.Sentry = sentry2;

            // transform casePlanModel
            CmmnActivity newActivity = handler.handleElement(casePlanModel, context);

            context.Parent = newActivity;
            SentryHandler sentryHandler = new SentryHandler();

            // transform first Sentry
            CmmnSentryDeclaration firstSentryDeclaration = sentryHandler.handleElement(sentry1, context);

            // transform second Sentry
            CmmnSentryDeclaration secondSentryDeclaration = sentryHandler.handleElement(sentry2, context);

            // when
            handler.initializeExitCriterias(casePlanModel, newActivity, context);

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

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

            assertTrue(newActivity.ExitCriteria.Contains(firstSentryDeclaration));
            assertTrue(newActivity.ExitCriteria.Contains(secondSentryDeclaration));
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExitCriteria()
        public virtual void testExitCriteria()
        {
            // 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));
            Body body = createElement(conditionExpression, null, typeof(Body));

            body.TextContent = "${test}";

            // set exitCriteria
            ExitCriterion criterion = createElement(casePlanModel, typeof(ExitCriterion));

            criterion.Sentry = sentry;

            // transform casePlanModel
            CmmnActivity newActivity = handler.handleElement(casePlanModel, context);

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

            // when
            handler.initializeExitCriterias(casePlanModel, newActivity, context);

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

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

            assertEquals(sentryDeclaration, newActivity.ExitCriteria[0]);
        }