Skip to content

Commit 644c5e3

Browse files
author
Gonzalo Diaz
committed

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,8 @@ _NCrunch*
135135
# VSCode C# Dev Kit
136136

137137
.mono
138+
139+
# Coverage
140+
coverage.cobertura.xml
141+
coverage.json
142+
lcov.info

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ build: env dependencies
7979
${PACKAGE_TOOL} build --verbosity ${VERBOSITY_LEVEL}
8080

8181
test: build
82-
${PACKAGE_TOOL} test --verbosity ${VERBOSITY_LEVEL}
82+
${PACKAGE_TOOL} test --verbosity ${VERBOSITY_LEVEL} /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=lcov.info
8383

8484
coverage: dependencies
8585

algorithm-exercises-csharp/algorithm-exercises-csharp.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="coverlet.collector" Version="6.0.0" />
19+
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
20+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21+
<PrivateAssets>all</PrivateAssets>
22+
</PackageReference>
1923
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
2024
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
2125
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace algorithm_exercises_csharp;
2+
3+
public class HelloWorld
4+
{
5+
protected HelloWorld() {}
6+
7+
public static string Hello()
8+
{
9+
return "Hello World!";
10+
}
11+
}

algorithm-exercises-csharp/src/UnitTest1.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ public class UnitTest1
66
[TestMethod]
77
public void TestMethod1()
88
{
9-
}
10-
}
9+
string expected = "Hello World!";
10+
string result = HelloWorld.Hello();
1111

12-
public class unittest2
13-
{
14-
[TestMethod]
15-
public void TestMethod1()
16-
{
12+
Assert.AreEqual(expected, result);
1713
}
1814
}
15+

0 commit comments

Comments
 (0)