public void AddsIncomingTransitionOnNode() { var model = new WorkflowDefinitionModel(); model.Nodes.Add(new NodeModel { Identifier = "node", OutgoingTransitions = new[] { new TransitionModel { Identifier = "transitionId", Source = "node", Destination = "destNode" } } }); model.Nodes.Add(new NodeModel { Identifier = "destNode" }); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); var destNode = definition.Nodes.First(n => n.Identifier == "destNode"); Assert.That(destNode.IncomingTransitions.Count(), Is.EqualTo(1)); var transition = destNode.IncomingTransitions.First(); Assert.That(transition.Identifier, Is.EqualTo("transitionId")); Assert.That(transition.Source.Identifier, Is.EqualTo("node")); }
public void AddsNestedWorkflow() { var model = new WorkflowDefinitionModel(); model.Nodes.Add(new NodeModel { Identifier = "node", OutgoingTransitions = new[] { new TransitionModel { Identifier = "transitionId", Source = "node", Destination = "nested" } } }); model.Nodes.Add(new WorkflowDefinitionModel { Identifier = "nested", OperationType = typeof (TakeDefaultTransitionOperation).AssemblyQualifiedName }); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); var nestedWorkflow = definition.Nodes.FirstOrDefault(n => n.Identifier == "nested"); Assert.That(nestedWorkflow, Is.Not.Null); Assert.That(nestedWorkflow, Is.InstanceOf<IWorkflowDefinition>()); }
public void SetsWorkflowIdentifier() { var model = new WorkflowDefinitionModel {Identifier = "identifier"}; model.Nodes.Add(new NodeModel { Identifier = "node" }); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); Assert.That(definition.Identifier, Is.EqualTo("identifier")); }
public void SetsStartNodePropertyOnNode() { var model = new WorkflowDefinitionModel(); model.Nodes.Add(new NodeModel { Identifier = "node", IsInitialNode = true }); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); var node = definition.Nodes.First(); Assert.That(definition.InitialNode, Is.EqualTo(node)); }
public void SetsDefaultPropertyOnTransition() { var model = new WorkflowDefinitionModel(); model.Nodes.Add(new NodeModel { Identifier = "node", OutgoingTransitions = new[] { new TransitionModel { Identifier = "transitionId", IsDefault = true, Source = "node", Destination = "destNode" } } }); model.Nodes.Add(new NodeModel { Identifier = "destNode" }); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); var transition = definition.Nodes.First(n => n.Identifier == "node").OutgoingTransitions.First(); Assert.That(transition.IsDefault); }
public void ReturnsEmptyWorkflowDefinitionIfModelIsEmpty() { var model = new WorkflowDefinitionModel(); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); Assert.That(definition, Is.Not.Null); Assert.That(definition.Nodes, Is.Empty); Assert.That(definition.OutgoingTransitions, Is.Empty); Assert.That(definition.IncomingTransitions, Is.Empty); }
public void AddsOperationToNode() { var model = new WorkflowDefinitionModel(); model.Nodes.Add(new NodeModel { Identifier = "node", OperationType = typeof (TestOperation).AssemblyQualifiedName }); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); Assert.That(definition.Nodes.First().Operation, Is.EqualTo(typeof (TestOperation))); }
public void AddsNode() { var model = new WorkflowDefinitionModel(); model.Nodes.Add(new NodeModel { Identifier = "node" }); var transformer = new Transform.WorkflowDefinitionTransformer(); IWorkflowDefinition definition = transformer.TransformBack(model); Assert.That(definition.Nodes.Count, Is.EqualTo(1)); Assert.That(definition.Nodes.First().Identifier, Is.EqualTo("node")); }