public void TestGeneratingSolutionXmlReport() { VSSolutionLocMetrics metrics = new VSSolutionLocMetrics("ProjectPilot.sln"); metrics.LocStatsMap.AddToMap(".cs", new CSharpLocStats()); metrics.CalculateLocForSolution(@"..\..\..\ProjectPilot.sln"); const string ReportFileName = @"XML_report.xml"; metrics.GenerateXmlReport(ReportFileName); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(ReportFileName); XmlNode xmlNode = xmlDocument.SelectSingleNode( "Root/Item/Subitem/Item[contains(@FileName,'ProjectPilot.Framework.csproj')]"); Assert.IsNotNull(xmlNode); Assert.AreEqual(".csproj", xmlNode.Attributes["FileType"].Value); xmlNode = xmlDocument.SelectSingleNode( "Root/Item/Subitem/Item/Subitem/Item"); Assert.AreEqual(".cs", xmlNode.Attributes["FileType"].Value); }
public ActionResult GenerateXML(string solutionFilePath) { VSSolutionLocMetrics metrics = new VSSolutionLocMetrics(solutionFilePath.Substring(solutionFilePath.LastIndexOf(@"\") + 1)); metrics.LocStatsMap.AddToMap(".cs", new CSharpLocStats()); metrics.CalculateLocForSolution(solutionFilePath); metrics.GenerateXmlReport(@"XML_report.xml"); return(RedirectToAction("XML", "XML")); }
public void SolutionLocMetrics() { VSSolutionLocMetrics metrics = new VSSolutionLocMetrics("ProjectPilot.sln"); // add known extensions metrics.LocStatsMap.AddToMap(".cs", new CSharpLocStats()); metrics.LocStatsMap.AddToMap(".aspx", new AspxLocStats()); metrics.CalculateLocForSolution( @"..\..\..\ProjectPilot.sln"); LocStatsData data = metrics.GetLocStatsData(); }