//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void testListenerInvocationFinishesBeforeSubsequentInvocations() public virtual void testListenerInvocationFinishesBeforeSubsequentInvocations() { caseService.withCaseDefinitionByKey("case").create(); CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); assertNotNull(taskExecution); // when i set a variable and the listener itself sets another variable caseService.withCaseExecution(taskExecution.Id).setVariableLocal("variable", "value1").execute(); // then all listeners for the first variable update are invoked first // and then the listeners for the second update are invoked IList <DelegateCaseVariableInstance> invocations = LogAndUpdateVariableListener.Invocations; assertEquals(6, invocations.Count); // the first invocations should regard the first value DelegateVariableInstanceSpec.fromCaseExecution(taskExecution).@event([email protected]_Fields.CREATE).name("variable").value("value1").matches(LogAndUpdateVariableListener.Invocations[0]); DelegateVariableInstanceSpec.fromCaseExecution(taskExecution).@event([email protected]_Fields.CREATE).name("variable").value("value1").matches(LogAndUpdateVariableListener.Invocations[1]); // the second invocations should regard the updated value // there are four invocations since both listeners have set "value2" and both were again executed, i.e. 2*2 = 4 for (int i = 2; i < 6; i++) { DelegateVariableInstanceSpec.fromCaseExecution(taskExecution).@event([email protected]_Fields.UPDATE).name("variable").value("value2").matches(LogAndUpdateVariableListener.Invocations[i]); } LogAndUpdateVariableListener.reset(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void testTwoListenersOnSameScope() public virtual void testTwoListenersOnSameScope() { caseService.withCaseDefinitionByKey("case").create(); CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); assertNotNull(taskExecution); // when i set a variable caseService.withCaseExecution(taskExecution.Id).setVariableLocal("testVariable", "value1").execute(); // then both listeners are invoked assertEquals(1, LogVariableListener.Invocations.Count); DelegateVariableInstanceSpec.fromCaseExecution(taskExecution).@event([email protected]_Fields.CREATE).name("testVariable").value("value1").matches(LogVariableListener.Invocations[0]); assertEquals(1, LogAndUpdateVariableListener.Invocations.Count); DelegateVariableInstanceSpec.fromCaseExecution(taskExecution).@event([email protected]_Fields.CREATE).name("testVariable").value("value1").matches(LogAndUpdateVariableListener.Invocations[0]); LogVariableListener.reset(); LogAndUpdateVariableListener.reset(); }