@@ -20,6 +20,7 @@ private sealed class Utf8StringWriter : StringWriter
20
20
21
21
public string Report ( CoverageResult result )
22
22
{
23
+ CoverageSummary summary = new CoverageSummary ( ) ;
23
24
XmlDocument xml = new XmlDocument ( ) ;
24
25
XmlElement coverage = xml . CreateElement ( "CoverageSession" ) ;
25
26
XmlElement coverageSummary = xml . CreateElement ( "Summary" ) ;
@@ -77,8 +78,8 @@ public string Report(CoverageResult result)
77
78
78
79
method . SetAttribute ( "cyclomaticComplexity" , "0" ) ;
79
80
method . SetAttribute ( "nPathComplexity" , "0" ) ;
80
- method . SetAttribute ( "sequenceCoverage" , "0" ) ;
81
- method . SetAttribute ( "branchCoverage" , "0" ) ;
81
+ method . SetAttribute ( "sequenceCoverage" , summary . CalculateLineCoverage ( meth . Value ) . ToString ( ) ) ;
82
+ method . SetAttribute ( "branchCoverage" , summary . CalculateBranchCoverage ( meth . Value ) . ToString ( ) ) ;
82
83
method . SetAttribute ( "isConstructor" , meth . Key . Contains ( "ctor" ) . ToString ( ) ) ;
83
84
method . SetAttribute ( "isGetter" , meth . Key . Contains ( "get_" ) . ToString ( ) ) ;
84
85
method . SetAttribute ( "isSetter" , meth . Key . Contains ( "set_" ) . ToString ( ) ) ;
@@ -161,8 +162,8 @@ public string Report(CoverageResult result)
161
162
methodSummary . SetAttribute ( "visitedSequencePoints" , meth . Value . Where ( l => l . Value . Hits > 0 ) . Count ( ) . ToString ( ) ) ;
162
163
methodSummary . SetAttribute ( "numBranchPoints" , meth . Value . Where ( l => l . Value . IsBranchPoint ) . Count ( ) . ToString ( ) ) ;
163
164
methodSummary . SetAttribute ( "visitedBranchPoints" , meth . Value . Where ( l => l . Value . IsBranchPoint && l . Value . Hits > 0 ) . Count ( ) . ToString ( ) ) ;
164
- methodSummary . SetAttribute ( "sequenceCoverage" , "0" ) ;
165
- methodSummary . SetAttribute ( "branchCoverage" , "0" ) ;
165
+ methodSummary . SetAttribute ( "sequenceCoverage" , summary . CalculateLineCoverage ( meth . Value ) . ToString ( ) ) ;
166
+ methodSummary . SetAttribute ( "branchCoverage" , summary . CalculateBranchCoverage ( meth . Value ) . ToString ( ) ) ;
166
167
methodSummary . SetAttribute ( "maxCyclomaticComplexity" , "0" ) ;
167
168
methodSummary . SetAttribute ( "minCyclomaticComplexity" , "0" ) ;
168
169
methodSummary . SetAttribute ( "visitedClasses" , "0" ) ;
@@ -189,8 +190,8 @@ public string Report(CoverageResult result)
189
190
classSummary . SetAttribute ( "visitedSequencePoints" , cls . Value . Select ( c => c . Value . Where ( l => l . Value . Hits > 0 ) . Count ( ) ) . Sum ( ) . ToString ( ) ) ;
190
191
classSummary . SetAttribute ( "numBranchPoints" , cls . Value . Select ( c => c . Value . Count ( l => l . Value . IsBranchPoint ) ) . Sum ( ) . ToString ( ) ) ;
191
192
classSummary . SetAttribute ( "visitedBranchPoints" , cls . Value . Select ( c => c . Value . Where ( l => l . Value . Hits > 0 && l . Value . IsBranchPoint ) . Count ( ) ) . Sum ( ) . ToString ( ) ) ;
192
- classSummary . SetAttribute ( "sequenceCoverage" , "0" ) ;
193
- classSummary . SetAttribute ( "branchCoverage" , "0" ) ;
193
+ classSummary . SetAttribute ( "sequenceCoverage" , summary . CalculateLineCoverage ( cls . Value ) . ToString ( ) ) ;
194
+ classSummary . SetAttribute ( "branchCoverage" , summary . CalculateBranchCoverage ( cls . Value ) . ToString ( ) ) ;
194
195
classSummary . SetAttribute ( "maxCyclomaticComplexity" , "0" ) ;
195
196
classSummary . SetAttribute ( "minCyclomaticComplexity" , "0" ) ;
196
197
classSummary . SetAttribute ( "visitedClasses" , classVisited ? "1" : "0" ) ;
@@ -215,8 +216,8 @@ public string Report(CoverageResult result)
215
216
coverageSummary . SetAttribute ( "visitedSequencePoints" , visitedSequencePoints . ToString ( ) ) ;
216
217
coverageSummary . SetAttribute ( "numBranchPoints" , numBranchPoints . ToString ( ) ) ;
217
218
coverageSummary . SetAttribute ( "visitedBranchPoints" , visitedBranchPoints . ToString ( ) ) ;
218
- coverageSummary . SetAttribute ( "sequenceCoverage" , "0" ) ;
219
- coverageSummary . SetAttribute ( "branchCoverage" , "0" ) ;
219
+ coverageSummary . SetAttribute ( "sequenceCoverage" , summary . CalculateLineCoverage ( result . Modules ) . ToString ( ) ) ;
220
+ coverageSummary . SetAttribute ( "branchCoverage" , summary . CalculateLineCoverage ( result . Modules ) . ToString ( ) ) ;
220
221
coverageSummary . SetAttribute ( "maxCyclomaticComplexity" , "0" ) ;
221
222
coverageSummary . SetAttribute ( "minCyclomaticComplexity" , "0" ) ;
222
223
coverageSummary . SetAttribute ( "visitedClasses" , visitedClasses . ToString ( ) ) ;
0 commit comments