Exemplo n.º 1
0
        // Guid AddWorkflow(string name, XContainer xDocument)
        Guid AddWorkflow(string name, XContainer xDocument, string pathToWorkflowFile)
        {
            var testLabName = xDocument.Descendants(LogicConstants.WorkflowLoader_TestWorkflow_TestLabNode).FirstOrDefault().Value;

            var testLab = string.IsNullOrEmpty(testLabName) ?
                          GetFirstTestLab() :
                          GetOrCreateTestLab(testLabName);

            // _workflow = new TestWorkflow(testLab) { Name = name };
            _workflow = new TestWorkflow(testLab)
            {
                Name = name, Path = pathToWorkflowFile
            };
            // 20150708
            // if there already is a workflow with the same name
            // merge the new one with the existing
            var replace = false || WorkflowCollection.Workflows.Any(wfl => wfl.Name == _workflow.Name && wfl.Path == _workflow.Path);

            if (replace)
            {
                WorkflowCollection.MergeWorkflow(_workflow);
            }
            else
            {
                WorkflowCollection.AddWorkflow(_workflow);
            }

            ServerObjectFactory.Resolve <TestWorkflowCollectionMethods>().SetDefaultWorkflow();
            return(_workflow.Id);
        }
Exemplo n.º 2
0
        IWorkflow GivenLoadedWorkflow(int id, string name)
        {
            var workflow = new TestWorkflow(TestLabCollection.TestLabs.First())
            {
                Name = name
            };

            WorkflowCollection.AddWorkflow(workflow);
            return(workflow);
        }