示例#1
0
        public string GetValidStartEventOrError(string proposedStartEvent, out ProcessError startEventError)
        {
            startEventError = null;

            List <string> possibleStartEvents = _process.StartEvents();

            if (!string.IsNullOrEmpty(proposedStartEvent))
            {
                if (possibleStartEvents.Contains(proposedStartEvent))
                {
                    return(proposedStartEvent);
                }
                else
                {
                    startEventError = Conflict($"There is no such start event as '{proposedStartEvent}' in the process definition.");
                    return(null);
                }
            }

            if (possibleStartEvents.Count == 1)
            {
                return(possibleStartEvents.First());
            }
            else if (possibleStartEvents.Count > 1)
            {
                startEventError = Conflict($"There are more than one start events available. Chose one: {possibleStartEvents}");
                return(null);
            }
            else
            {
                startEventError = Conflict($"There is no start events in process definition. Cannot start process!");
                return(null);
            }
        }
示例#2
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);
        }