private void LoadProcessModel(string org, string app) { using (Stream definitions = processService.GetProcessDefinition(org, app)) { ProcessModel = BpmnReader.Create(definitions); } }
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); }
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); }
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); }
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); }
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); }
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); }
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]); }
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]); }
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); }
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); }
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); }
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); }
public ProcessHelper(Stream bpmnStream) { _process = BpmnReader.Create(bpmnStream); }