Example #1
0
 public void Merge(CoverageFileData coverageFileData)
 {
     // If LineExecutionCounts is null then this class has not be merged with any coverage object yet so just take its values
     if (LineExecutionCounts == null)
     {
         LineExecutionCounts = coverageFileData.LineExecutionCounts;
         SourceLines         = coverageFileData.SourceLines;
     }
     else
     {
         for (var i = 0; i < LineExecutionCounts.Length; i++)
         {
             if (!coverageFileData.LineExecutionCounts[i].HasValue)
             {
                 // No data to merge
                 continue;
             }
             else if (!this.LineExecutionCounts[i].HasValue)
             {
                 // Just take the given data
                 this.LineExecutionCounts[i] = coverageFileData.LineExecutionCounts[i];
             }
             else
             {
                 // If we both have values sum them up
                 this.LineExecutionCounts[i] += coverageFileData.LineExecutionCounts[i];
             }
         }
     }
 }
Example #2
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="coverageFileData"></param>
 public CoverageFileData(CoverageFileData coverageFileData)
 {
     this.FilePath            = coverageFileData.FilePath;
     this.LineExecutionCounts = coverageFileData.LineExecutionCounts.ToArray();
     this.SourceLines         = coverageFileData.SourceLines.ToArray();
 }