public void ToReferenceXMLTest() { ProjectList target = new ProjectList(); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; actual = target.ToReferenceXML(); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); }
private string PushDataIntoDB(ProjectList projects, string name) { string connectionString = "Integrated Security=SSPI;Initial Catalog=ShareDB;Data Source=devdb.dev.sh.ctriptravel.com,28747"; using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connectionString)) { System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); cmd.Connection = conn; cmd.CommandText = @"INSERT INTO [CDM_DBXML]([DBName],[XMLData],[ModifyDate]) VALUES (@dbname,@xmlData,getdate()); select @tid = @@Identity"; cmd.Parameters.AddWithValue("@dbname", name); cmd.Parameters.AddWithValue("@xmlData", projects.ToReferenceXML()); cmd.Parameters.Add("@tid", System.Data.SqlDbType.Int); cmd.Parameters["@tid"].Direction = System.Data.ParameterDirection.Output; //cmd.CommandText = "INSERT INTO [CDM_DBXML]([DBName],[XMLData],[ModifyDate]) VALUES ('" + DateTime.Now.ToString("yyyymmddhhMMss") + "','" + projects.ToReferenceXML() + "',getdate())"; conn.Open(); cmd.ExecuteNonQuery(); int rValue = Convert.ToInt32(cmd.Parameters["@tid"].Value); Console.WriteLine(rValue); return name; } }
private void ConsoleOutput(ProjectList projects, string OutputPath) { if (projects.Count == 0) { Console.WriteLine("No Project was found, please remove mainonlyflag and try again"); return; } //loop through every project and output its dependencies to the file in the format //parent -> child && Child back to parent string[] path = SearchPath.Split('\\'); // string rootName = + ; string rootName = string.Format("{0}_{1}", path.Length > 0 ? path[path.Length - 1] : projects[0].Name , DateTime.Now.ToString("yyyymmddhhMMss")); StringBuilder sbRefer = new StringBuilder(); FileStream fs; if (!Directory.Exists(OutputPath)) Directory.CreateDirectory(OutputPath); string target = string.Format("{0}\\{1}_relation.xml", OutputPath, rootName); if (File.Exists(target)) { File.Delete(target); } ProjectList distinctProjects = new ProjectList(); GetDistinctProjects(projects, distinctProjects); System.IO.File.WriteAllText(target, distinctProjects.ToReferenceXML()); OutputPath = string.Format("{0}\\{1}_details", OutputPath, rootName); if (!Directory.Exists(OutputPath)) Directory.CreateDirectory(OutputPath); foreach (Project p in distinctProjects) { target = string.Format("{0}\\{1}.txt", OutputPath, p.Name); if (File.Exists(target)) { File.Delete(target); } fs = System.IO.File.OpenWrite(target); using (StreamWriter outfile = new StreamWriter(fs)) { FetchProjectRefence(p, "Root", outfile, true); } } OutputPath = string.Format("{0}\\..\\{1}_ReferedBy", OutputPath, rootName); if (!Directory.Exists(OutputPath)) Directory.CreateDirectory(OutputPath); ProcessedLinks.Clear(); foreach (Project p in distinctProjects) { target = string.Format("{0}\\{1}.txt", OutputPath, p.Name); if (File.Exists(target)) { File.Delete(target); } fs = System.IO.File.OpenWrite(target); using (StreamWriter outfile = new StreamWriter(fs)) { FetchProjectReferedBy(p, distinctProjects, p.Name, outfile, p.Name); } } // Write to DB string rowName = PushDataIntoDB(distinctProjects, rootName); System.Diagnostics.Process.Start(string.Format("http://citsm.sh.ctriptravel.com/CITSM.Data/index.aspx?listid=8&DesignName=&DesignDBName={0}", rowName)); }