public void IsConnected_WorkflowWithTwoDoublyConnectedStates_ReturnTrue() { // Arrange var workflow = new IeWorkflow { States = new List <IeState> { new IeState { Name = "New", IsInitial = true }, new IeState { Name = "Done" } }, TransitionEvents = new List <IeTransitionEvent> { new IeTransitionEvent { FromState = "New", ToState = "Done" }, new IeTransitionEvent { FromState = "Done", ToState = "New" } } }; var graph = new WorkflowGraph(workflow); // Assert Assert.AreEqual(true, graph.IsConnected()); }
public void IsConnected_ComplexConnectedWorkflow_ReturnsTrue() { // Arrange var workflow = new IeWorkflow { States = new List <IeState> { new IeState { Name = "New", IsInitial = true }, new IeState { Name = "Ready" }, new IeState { Name = "In Progress" }, new IeState { Name = "On Hold" }, new IeState { Name = "Done" } }, TransitionEvents = new List <IeTransitionEvent> { new IeTransitionEvent { FromState = "New", ToState = "Ready" }, new IeTransitionEvent { FromState = "Ready", ToState = "In Progress" }, new IeTransitionEvent { FromState = "In Progress", ToState = "On Hold" }, new IeTransitionEvent { FromState = "On Hold", ToState = "In Progress" }, new IeTransitionEvent { FromState = "In Progress", ToState = "Done" } } }; var graph = new WorkflowGraph(workflow); // Assert Assert.AreEqual(true, graph.IsConnected()); }
public void IsConnected_WorkflowWithInitialState_ReturnTrue() { // Arrange var workflow = new IeWorkflow { States = new List <IeState> { new IeState { Name = "New", IsInitial = true } }, TransitionEvents = new List <IeTransitionEvent>() }; var graph = new WorkflowGraph(workflow); // Assert Assert.AreEqual(true, graph.IsConnected()); }
public void IsConnected_WorkflowWithTwoDisconnectedStates_ReturnFalse() { // Arrange var workflow = new IeWorkflow { States = new List <IeState> { new IeState { Name = "New", IsInitial = true }, new IeState { Name = "Done" } }, TransitionEvents = new List <IeTransitionEvent>() }; var graph = new WorkflowGraph(workflow); // Assert Assert.AreEqual(false, graph.IsConnected()); }