Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
$sonarQubeUrl = $env:SONARQUBE_URL
$sonarQubeToken = $env:SONARQUBE_TOKEN
$solution = ".\src\main.sln"
$projectKey = "example:dotCover"
$projectName = "Example: dotCover .NET Coverage"
$projectKey = "lukas-frystak-sonarsource_dotCoverExample_AYXeU10iRWnsrqWqXvlh"
$projectName = "dotCoverExample"
$version = "1.0.0"

$coverageReportDirectory = ".\TestResults"
$coverageReportPath = "$coverageReportDirectory\dotCover.Output.html"
# The unit test results are stored in each test project: *Tests\TestResults\*.trx
$testReportPath = ".\**\*.trx"

$branchName = git rev-parse --abbrev-ref HEAD

# =====================================================================================================================================

# Firstly, clean existing test results if any exist. We need to do this as
Expand All @@ -35,7 +37,11 @@ dotnet sonarscanner begin `
/d:sonar.host.url=$sonarQubeUrl /d:sonar.login=$sonarQubeToken `
/d:sonar.cs.dotcover.reportsPaths=$coverageReportPath `
/d:sonar.cs.vstest.reportsPaths=$testReportPath `
/d:sonar.verbose=false
/d:sonar.verbose=false `
#/d:sonar.branch.name=1$branchName
#/d:sonar.pullrequest.branch=test/coverage `
#/d:sonar.pullrequest.base=main `
#/d:sonar.pullrequest.key=1

# Build the solution.
dotnet build $solution --configuration Release
Expand Down
22 changes: 22 additions & 0 deletions src/MathLibrary/DataProcessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace MathLibrary
{
public class DataProcessor
{
private readonly string _instance = string.Empty;

public DataProcessor()
{
_instance = "test";
}

public string Instance
{
get
{
return _instance;
}
}
}
}
4 changes: 2 additions & 2 deletions src/MathLibraryTests/CalculatorTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using NUnit.Framework;
using MathLibrary;

namespace CalculatorTests
namespace MathLibraryTests
{
public class Tests
public class CalculatorTests
{
[SetUp]
public void Setup()
Expand Down
20 changes: 20 additions & 0 deletions src/MathLibraryTests/DataProcessorTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using NUnit.Framework;
using MathLibrary;

namespace MathLibraryTests
{
public class DataProcessorTests
{
[SetUp]
public void Setup()
{
// Nothing here yet.
}

[Test]
public void ConstructorTest()
{
Assert.DoesNotThrow(() => new DataProcessor());
}
}
}