//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSentryWithIfPart() public virtual void testSentryWithIfPart() { // given IfPart ifPart = createElement(sentry, "abc", typeof(IfPart)); ConditionExpression conditionExpression = createElement(ifPart, "def", typeof(ConditionExpression)); Body body = createElement(conditionExpression, null, typeof(Body)); string expression = "${test}"; body.TextContent = expression; // when CmmnSentryDeclaration sentryDeclaration = sentryHandler.handleElement(sentry, context); // then assertNotNull(sentryDeclaration); CmmnIfPartDeclaration ifPartDeclaration = sentryDeclaration.IfPart; assertNotNull(ifPartDeclaration); Expression condition = ifPartDeclaration.Condition; assertNotNull(condition); assertEquals(expression, condition.ExpressionText); assertTrue(sentryDeclaration.OnParts.Count == 0); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSentryWithIfPartWithMultipleCondition() public virtual void testSentryWithIfPartWithMultipleCondition() { // given IfPart ifPart = createElement(sentry, "abc", typeof(IfPart)); ConditionExpression firstConditionExpression = createElement(ifPart, "con_1", typeof(ConditionExpression)); Body firstBody = createElement(firstConditionExpression, null, typeof(Body)); string firstExpression = "${firstExpression}"; firstBody.TextContent = firstExpression; ConditionExpression secondConditionExpression = createElement(ifPart, "con_2", typeof(ConditionExpression)); Body secondBody = createElement(secondConditionExpression, null, typeof(Body)); string secondExpression = "${secondExpression}"; secondBody.TextContent = secondExpression; // when CmmnSentryDeclaration sentryDeclaration = sentryHandler.handleElement(sentry, context); // then assertNotNull(sentryDeclaration); CmmnIfPartDeclaration ifPartDeclaration = sentryDeclaration.IfPart; assertNotNull(ifPartDeclaration); Expression condition = ifPartDeclaration.Condition; assertNotNull(condition); assertEquals(firstExpression, condition.ExpressionText); // the second condition will be ignored! assertTrue(sentryDeclaration.OnParts.Count == 0); }
protected internal virtual void initializeIfPart(IfPart ifPart, CmmnSentryDeclaration sentryDeclaration, CmmnHandlerContext context) { if (ifPart == null) { return; } ICollection <ConditionExpression> conditions = ifPart.Conditions; if (conditions.Count > 1) { string id = sentryDeclaration.Id; LOG.multipleIgnoredConditions(id); } ExpressionManager expressionManager = context.ExpressionManager; ConditionExpression condition = conditions.GetEnumerator().next(); Expression conditionExpression = expressionManager.createExpression(condition.Text); CmmnIfPartDeclaration ifPartDeclaration = new CmmnIfPartDeclaration(); ifPartDeclaration.Condition = conditionExpression; sentryDeclaration.IfPart = ifPartDeclaration; }