/QuotesService

Primary LanguageC#MIT LicenseMIT

UnitTesting-HxGN

This project contains all information, code and examples to complete the unit-testing day @HxGN, 03/10/2022.

Prerequisites

Getting started

  • Clone this repo to your local storage
  • Open the solution (.Net 6) in your code editor of choice
  • Restore nugets and build project
  • You are ready to go.

Coverage reports

To create coverage reports, open powershell in the "QuotesService" directory and execute the lines below.

dotnet test --collect:"XPlat Code Coverage"

$dir = ".\QuotesService.UnitTests\TestResults"
$latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1
Copy-Item $dir\$latest\coverage.cobertura.xml -Destination .\

dotnet $env:USERPROFILE\.nuget\packages\reportgenerator\5.0.4\tools\net6.0\ReportGenerator.dll "-reports:coverage.cobertura.xml" "-targetdir:.\report"

Start-Process .\report\index.html