public Dictionary<string, string> GetSequenceDiagramAsStringForEachProjects()
        {
            tcProjects = _objectBuilder.BuildObjectGraph(_configPath);
            tcProjects.ForEach(tcp =>
                                   {
                                       dictionary.Add(tcp.Id, GenerateDependencyString(tcp.Id, tcProjects));

                                   });
            return dictionary;
        }
 public TcProjects CreateTCProjects(Dictionary<string, string> projectConfigs)
 {
     var tcProjects = new TcProjects();
     projectConfigs.Keys.ForEach(pc =>
                                     {
                                         var tcProject = new ProjectFileParser().Parse(projectConfigs[pc]);
                                         tcProject.ProjectName = DirectoryAndFileOperations.GetFolderNameFromPath(pc);
                                         tcProjects.Add(tcProject);
                                     });
     return tcProjects;
 }
 public void SetUp()
 {
     path = "path";
     tcProjects = new TcProjects();
     var tcProject1 = new TcProject("Project1");
     var blankList = new List<string>();
     tcProject1.BuildConfigurations.Add(new TcBuildConfiguration("BC1", "Build", blankList, blankList, true, null));
     tcProject1.BuildConfigurations.Add(new TcBuildConfiguration("BC2", "UnitTest", new List<string> { "BC1" }, blankList, false, null));
     tcProject1.BuildConfigurations.Add(new TcBuildConfiguration("BC3", "Artifacts", new List<string> { "BC2" }, new List<string> { "BC4", "BC5" }, false, null));
     tcProject1.BuildConfigurations.Add(new TcBuildConfiguration("BC4", "ContractTest1", blankList, blankList, false, null));
     tcProject1.BuildConfigurations.Add(new TcBuildConfiguration("BC5", "ContractTest2", blankList, blankList, false, null));
     tcProjects.Add(tcProject1);
 }
        //This is a recursive method that will keep on driling a build
        // configuration one after the other in the workflow
        private void DrillDependency(TcBuildConfiguration drillPoint, TcProjects tcProjects)
        {
            var dependentBuilds = tcProjects.FindAllBuildConfigurationsDependentOnBuildConfigurationId(drillPoint.Id);
            drillPoint.SnapshotDependency.ForEach(sd =>
            {
                var desc = String.Format("{0} will wait for this to complete successfully",drillPoint.Name);
                finalString += FormatString(tcProjects, drillPoint, tcProjects.FindBuildConfigurationById(sd),desc);
            });

            if (drillPoint.HasArtifactsDependency)
            {
                drillPoint.ArtifactsDependency.ForEach(ad =>
                {
                    var desc = string.Format("Get {0} artifacts", ad.ArtifactFile);
                    finalString += FormatStringForArtifacts(tcProjects, drillPoint, tcProjects.FindBuildConfigurationById
                                    (ad.BuildConfigurationId), desc);
                });
            }

            if (drillPoint.HasSnapshotDependency)
            {
                finalString += FormatString(tcProjects, drillPoint, drillPoint, string.Format("After successful completion of all, {0} will complete",drillPoint.Name));
            }

            if (dependentBuilds.Count != 0)
                dependentBuilds.ForEach(db =>
                {
                    finalString += FormatString(tcProjects, drillPoint, db,
                                                "On completion of " + drillPoint.Name);
                });

            if (dependentBuilds.Count != 0)
                dependentBuilds.ForEach(db => DrillDependency(db, tcProjects));

            return ;
        }
        private string GenerateDependencyString(string pd, TcProjects tcProjects)
        {
            var tcProject = tcProjects.Find(p => p.Id.Equals(pd));
            var startPoints = GetBuildConfigurationsToStartDrillingFrom(tcProject);
            if (startPoints.Count > 0)
                startPoints.ForEach(sp =>
                                        {
                                            finalString = string.Empty;
                                            DrillDependency(sp, tcProjects);
                                            files.Add(new OutputFile(tcProject, sp.Name, finalString));
                                        });

            return  finalString;
        }
 private string FormatStringForArtifacts(TcProjects tcProjects, TcBuildConfiguration drillPoint, TcBuildConfiguration db, string desc)
 {
     return string.Format("{0}-{1}-->{2}-{3}:{4}#", tcProjects.FindProjectByBuildConfigurationId(drillPoint.Id).ProjectName, drillPoint.Name, tcProjects.FindProjectByBuildConfigurationId(db.Id).ProjectName, db.Name, desc ?? string.Empty);
 }