Beispiel #1
0
 private void LoadProcessModel(string org, string app)
 {
     using (Stream definitions = processService.GetProcessDefinition(org, app))
     {
         ProcessModel = BpmnReader.Create(definitions);
     }
 }
Beispiel #2
0
        public void Create_InputBpmnDescriptionAsString_ReturnsInitializedBpmnReader()
        {
            // Arrange
            string definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.multiple_events.bpmn");

            // Act
            BpmnReader actual = BpmnReader.Create(definitions);

            // Assert
            Assert.NotNull(actual);
        }
Beispiel #3
0
        public void Tasks_DefinitionHasTwoTasks_AskForTask_ReturnsAllTasks()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.default_process.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            List <string> actual = target.Tasks();

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(2, actual.Count);
        }
Beispiel #4
0
        public void EndEvents_DefinitionHasTwoEndEvent_AskForEndEvent_ReturnsEndEvents()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.multiple_events.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            List <string> actual = target.EndEvents();

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(2, actual.Count);
        }
Beispiel #5
0
        public void NextElements_DefinitionHasTwoEndEvents_AskForNextStepFromLastTask_ReturnsIdOfBothEndEvents()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.multiple_events.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            List <string> actual = target.NextElements("Task_08wkkve");

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(2, actual.Count);
        }
Beispiel #6
0
        public void StartEvents_DefinitionHasOneStartEvent_AskForStartEvents_ReturnsSingleStartEvent()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.default_process.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            List <string> actual = target.StartEvents();

            // Assert
            Assert.NotNull(actual);
            Assert.Single(actual);
        }
Beispiel #7
0
        public void GetStartElementId_ProcessWithOneStartEvent_IdentifyInitialTask()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.default_process.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            string actual = target.GetStartElementId();

            // Assert
            Assert.NotNull(actual);
            Assert.Equal("FormFilling_1", actual);
        }
Beispiel #8
0
        public void NextElements_AskForNextStepFromStartEvent_ReturnsNextTaskId()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.multiple_events.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            List <string> actual = target.NextElements("StartEvent_0mau26i");

            // Assert
            Assert.NotNull(actual);
            Assert.Single(actual);
            Assert.Equal("Task_14svrga", actual[0]);
        }
Beispiel #9
0
        public void NextElements_DefinitionsHaveTwoTasks_AskForNextStepAfterFirst_ReturnsNextElementId(string currentId, string nextId)
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.default_process.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            List <string> actual = target.NextElements(currentId);

            // Assert
            Assert.NotNull(actual);
            Assert.Single(actual);
            Assert.Equal(nextId, actual[0]);
        }
Beispiel #10
0
        public void GetElementInfo_AskForExistingElement_ReturnsInfoAboutElement(string id, string elementType, string taskType)
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.default_process.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            // Act
            ElementInfo actual = target.GetElementInfo(id);

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(id, actual.Id);
            Assert.Equal(elementType, actual.ElementType);
            Assert.Equal(taskType, actual.AltinnTaskType);
        }
Beispiel #11
0
        public void NextElements_AskForNextStepWithANonexistingId_ThrowsProcessException()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.multiple_events.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            ProcessException actual = null;

            // Act
            try
            {
                _ = target.NextElements("donotexist");
            }
            catch (ProcessException pe)
            {
                actual = pe;
            }

            // Assert
            Assert.NotNull(actual);
            Assert.IsType <ProcessException>(actual);
        }
Beispiel #12
0
        public void GetStartElementId_ProcessWithTwoStartEvents_IdentifyInitialTask_ThrowsProcessException()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.multiple_events.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            ProcessException actual = null;

            // Act
            try
            {
                _ = target.GetStartElementId();
            }
            catch (ProcessException pe)
            {
                actual = pe;
            }

            // Assert
            Assert.NotNull(actual);
            Assert.IsType <ProcessException>(actual);
        }
Beispiel #13
0
        public void GetElementInfo_AskForElementInfoForElementNull_ThrowsArgumentNullException()
        {
            // Arrange
            string     definitions = LoadResourceAsString("Altinn.Process.UnitTest.TestData.default_process.bpmn");
            BpmnReader target      = BpmnReader.Create(definitions);

            ArgumentNullException actual = null;

            // Act
            try
            {
                _ = target.GetElementInfo(null);
            }
            catch (ArgumentNullException ane)
            {
                actual = ane;
            }

            // Assert
            Assert.NotNull(actual);
            Assert.IsType <ArgumentNullException>(actual);
            Assert.Equal("elementId", actual.ParamName);
        }
Beispiel #14
0
 public ProcessHelper(Stream bpmnStream)
 {
     _process = BpmnReader.Create(bpmnStream);
 }