This project has moved. For the latest updates, please go here.

Report Generator issue for LINQ commands

Jun 23, 2014 at 8:14 AM
Thanks for the good open source unit test coverage reporting tool. We are using the tool for one of our production projects as main coverage tool.

We are facing an issue related to the LINQ queries coverage report. Could you please help us to resolve ?

Sample 1. From Line number 249 to 262 is the single LINQ statement. But tool is showing line number 249 is covered and rest of the lines are not covered. The percentage of coverage is also reduced.
    1   249                 lstReconcileDetailType2.ForEach(record =>
    0   250                 {
    0   251                     unitOfWork.AddSaveEntity<ReconcileDetailType2>(new ReconcileDetailType2
        252                     {
        253                         ReconcileDetailB2Key = NewReconcileDetailB2Key,
        254                         PaymentTypeKey = record.PaymentTypeKey,
        255                         ForeignCurrencyCode = record.ForeignCurrencyCode,
        256                         TransacationCount = record.TransacationCount,
        257                         BaseAmountFin = record.BaseAmountFin,
        258                         ForeignAmountFin = record.ForeignAmountFin,
        259                         SettlementCurrencyCode = record.SettlementCurrencyCode,
        260                         TotalSettlementAmount = record.TotalSettlementAmount
        261                     });
        262                 });
Sample 2:
Though the following lines are shown as covered, the branch level coverage for the following method is only 66.67 %. Could you please help us to understand ?
        231         private bool CheckDuplicateISOCountryID(DataModel.ISOCountry objCountry)
    1   232         {
    1   233             bool isIDExist = objCountryMasterDataRepository.Check(record =>
        234                                                 (record.ISOCountryID == objCountry.ISOCountryID &&
        235                                                  record.ISOCountryKey != objCountry.ISOCountryKey &&
        236                                                  record.IsDeleted == false));
    1   237             return isIDExist;
    1   238         }
Thanks,
Sabarinathan Arthanari.
Coordinator
Jun 23, 2014 at 9:42 AM
Hi Sabarinathan,

which coverage tool are you using? OpenCover?

Best regards,

Daniel
Coordinator
Jun 23, 2014 at 10:44 AM
Hi Sabarinathan,

regarding Sample 1:
Please try latest beta release, this should fix the problem:
https://reportgenerator.codeplex.com/releases/view/121371
http://www.nuget.org/packages/ReportGenerator/2.0.0-beta5

regarding Sample 2:
The branch coverage is measured by the coverage tool (e.g. OpenCover). Since I don't know your test code, I can only guess that one the 3 conditions is never met:
  • record.ISOCountryID == objCountry.ISOCountryID
  • record.ISOCountryKey != objCountry.ISOCountryKey
  • record.IsDeleted == false
Best regards,

Daniel
Jun 23, 2014 at 1:02 PM
Hi Daniel,

Thanks for providing the quick update !!
  1. Yes We are using the Open Cover tool.
  2. I'll try the new beta release and let you know.
  3. I'll check the second Sample in my code and get back to you.
Thanks again,
Sabarinathan A.