private CoberturaPackage GetCoberturaPackage(DotCoverAssembly dotCoverAssembly) { var coberturaPackage = new CoberturaPackage(); coberturaPackage.Name = dotCoverAssembly.Name; coberturaPackage.BranchRate = 0; coberturaPackage.Complexity = 0; coberturaPackage.LineRate = dotCoverAssembly.CoveragePercent * 0.01m; coberturaPackage.Classes = GetCoberturaClassesForDotCoverAssembly(dotCoverAssembly); return(coberturaPackage); }
private List <CoberturaClass> GetCoberturaClassesForDotCoverAssembly(DotCoverAssembly dotCoverAssembly) { var coberturaClasses = new List <CoberturaClass>(); foreach (var dotCoverNamespace in dotCoverAssembly.Namespaces) { var coberturaClassesInNamespace = dotCoverNamespace.Types .Select(t => GetCoberturaClassFromDotCoverType(t, dotCoverNamespace.Name)); coberturaClasses.AddRange(coberturaClassesInNamespace); } return(coberturaClasses .Where(c => !string.IsNullOrWhiteSpace(c.FileName)) .ToList()); }
private DotCoverAssembly GetAssemblyFromElement(XElement assemblyElement) { var dotCoverAssembly = new DotCoverAssembly { CoveragePercent = assemblyElement.GetAttributeDecimalValue("CoveragePercent"), CoveredStatements = assemblyElement.GetAttributeIntValue("CoveredStatements"), TotalStatements = assemblyElement.GetAttributeIntValue("TotalStatements"), Name = assemblyElement.GetAttributeStringValue("Name"), Namespaces = assemblyElement.Elements() .Where(e => e.Name.LocalName == "Namespace") .Select(GetNamespaceFromElement) .ToList() }; return(dotCoverAssembly); }