예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testUpdateIncomingOutgoingChildElements()
        public virtual void testUpdateIncomingOutgoingChildElements()
        {
            BpmnModelInstance modelInstance = Bpmn.createProcess().startEvent().userTask("test").endEvent().done();

            // save current incoming and outgoing sequence flows
            UserTask userTask = modelInstance.getModelElementById("test");
            ICollection <SequenceFlow> incoming = userTask.Incoming;
            ICollection <SequenceFlow> outgoing = userTask.Outgoing;

            // create a new service task
            ServiceTask serviceTask = modelInstance.newInstance(typeof(ServiceTask));

            serviceTask.Id = "new";

            // replace the user task with the new service task
            userTask.replaceWithElement(serviceTask);

            // assert that the new service task has the same incoming and outgoing sequence flows
            assertThat(serviceTask.Incoming).containsExactlyElementsOf(incoming);
            assertThat(serviceTask.Outgoing).containsExactlyElementsOf(outgoing);
        }