protected static List<MorphAction> GenerateActionsViaDiffEngine()
        {
            if (_actionsViaDiffEngine != null) return _actionsViaDiffEngine;

            using (var agileTemplate = EmbeddedProcessTemplate.Agile6())
            using (var scrumTemplate = EmbeddedProcessTemplate.Scrum2())
            {
                var agileReader = new ProcessTemplateReader(agileTemplate.TemplatePath);
                var scrumReader = new ProcessTemplateReader(scrumTemplate.TemplatePath);

                var processTemplateMap = ProcessTemplateMap.ConvertScrum2ToAgile6();

                var currentProcessTemplate = new ProcessTemplate {WorkItemTypeDefinitions = new ReadOnlyCollection<WorkItemTypeDefinition>(scrumReader.WorkItemTypeDefinitions.ToArray())};
                var goalProcessTemplate = new ProcessTemplate {WorkItemTypeDefinitions = new ReadOnlyCollection<WorkItemTypeDefinition>(agileReader.WorkItemTypeDefinitions.ToArray())};

                var diffEngine = new DiffEngine(processTemplateMap);
                var differences = diffEngine.CompareProcessTemplates(currentProcessTemplate, goalProcessTemplate);

                var morphEngine = new MorphEngine();
                _actionsViaDiffEngine = morphEngine.GenerateActions(differences).ToList();
            }

            return _actionsViaDiffEngine;
        }
        private void SetupDifferences()
        {
            WorkItemTypeDefinition workItemTypeDefinition;
            WitdField field;
            WitdState state;
            using (var template = EmbeddedProcessTemplate.Scrum2())
            {
                var templateReader = new ProcessTemplateReader(template.TemplatePath);
                workItemTypeDefinition = templateReader.WorkItemTypeDefinitions.First();
                field = workItemTypeDefinition.Fields.First(f => !f.ReferenceName.StartsWith("System."));
                state = workItemTypeDefinition.States.First();
            }

            _differences = new IDifference[]
                           {
                               new AddedWorkItemTypeDefinitionDifference(workItemTypeDefinition),
                               new AddedWorkItemStateDifference(workItemTypeDefinition.Name, state),
                               new AddedWorkItemFieldDifference(workItemTypeDefinition.Name, field),
                               new RenamedWorkItemTypeDefinitionDifference("User Story", "Product Backlog Item"),
                               new RenamedWorkItemFieldDifference(workItemTypeDefinition.Name, field.ReferenceName, field),
                               new RenamedWorkItemStateDifference(workItemTypeDefinition.Name, state.Value, state),
                               new ChangedWorkItemFieldDifference(workItemTypeDefinition.Name, field.ReferenceName, field),
                               new ChangedWorkItemStateDifference(workItemTypeDefinition.Name, state.Value, state),
                               new ChangedWorkItemFormDifference(workItemTypeDefinition.Name, workItemTypeDefinition.FormElement),
                               new ChangedWorkItemWorkflowDifference(workItemTypeDefinition.Name, workItemTypeDefinition.WorkflowElement),
                               new RemovedWorkItemTypeDefinitionDifference("Issue"),
                               new RemovedWorkItemFieldDifference(workItemTypeDefinition.Name, field.ReferenceName),
                               new RemovedWorkItemStateDifference(state.Value),
                               new ConsolidatedWorkItemStateDifference(workItemTypeDefinition.Name, state.Value, state)

                           };
        }
Exemplo n.º 3
0
        private void SetupDifferences()
        {
            WorkItemTypeDefinition workItemTypeDefinition;
            WitdState state;
            using (var template = EmbeddedProcessTemplate.Scrum2())
            {
                var templateReader = new ProcessTemplateReader(template.TemplatePath);
                workItemTypeDefinition = templateReader.WorkItemTypeDefinitions.First();
                state = workItemTypeDefinition.States.First();
            }

            _differences = new IDifference[]
                           {
                               new RemovedWorkItemTypeDefinitionDifference("Issue"),
                               new RenamedWorkItemStateDifference(workItemTypeDefinition.Name, "not-" + state.Value, state)
                           };
        }