File tree Expand file tree Collapse file tree 5 files changed +37
-9
lines changed
algorithm-exercises-csharp Expand file tree Collapse file tree 5 files changed +37
-9
lines changed Original file line number Diff line number Diff line change @@ -135,3 +135,8 @@ _NCrunch*
135
135
# VSCode C# Dev Kit
136
136
137
137
.mono
138
+
139
+ # Coverage
140
+ coverage.cobertura.xml
141
+ coverage.json
142
+ lcov.info
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ build: env dependencies
79
79
${PACKAGE_TOOL} build --verbosity ${VERBOSITY_LEVEL}
80
80
81
81
test : build
82
- ${PACKAGE_TOOL} test --verbosity ${VERBOSITY_LEVEL}
82
+ ${PACKAGE_TOOL} test --verbosity ${VERBOSITY_LEVEL} --collect: " Code Coverage "
83
83
84
84
coverage : dependencies
85
85
Original file line number Diff line number Diff line change 8
8
9
9
<IsPackable >false</IsPackable >
10
10
<IsTestProject >true</IsTestProject >
11
- <!---->
11
+
12
+ <!-- Coverage -->
13
+ <CollectCoverage >true</CollectCoverage >
14
+ <CoverletOutputFormat >lcov</CoverletOutputFormat >
15
+ <CoverletOutput >./lcov.info</CoverletOutput >
16
+ <IncludeTestAssembly >true</IncludeTestAssembly >
17
+
18
+ <!-- Static Analysis -->
12
19
<EnableNETAnalyzers >true</EnableNETAnalyzers >
13
20
<EnforceCodeStyleInBuild >true</EnforceCodeStyleInBuild >
14
21
<CodeAnalysisTreatWarningsAsErrors >false</CodeAnalysisTreatWarningsAsErrors >
15
22
</PropertyGroup >
16
23
17
24
<ItemGroup >
18
25
<PackageReference Include =" coverlet.collector" Version =" 6.0.0" />
26
+ <PackageReference Include =" coverlet.msbuild" Version =" 6.0.2" >
27
+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
28
+ <PrivateAssets >all</PrivateAssets >
29
+ </PackageReference >
19
30
<PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.8.0" />
20
31
<PackageReference Include =" MSTest.TestAdapter" Version =" 3.1.1" />
21
32
<PackageReference Include =" MSTest.TestFramework" Version =" 3.1.1" />
Original file line number Diff line number Diff line change @@ -6,13 +6,11 @@ public class UnitTest1
6
6
[ TestMethod ]
7
7
public void TestMethod1 ( )
8
8
{
9
- }
10
- }
9
+ string expected = "Hello World!" ;
10
+ string result = HelloWorld . Hello ( ) ;
11
+
12
+ Assert . AreEqual ( expected , result ) ;
11
13
12
- public class unittest2
13
- {
14
- [ TestMethod ]
15
- public void TestMethod1 ( )
16
- {
17
14
}
18
15
}
16
+
Original file line number Diff line number Diff line change
1
+ namespace algorithm_exercises_csharp ;
2
+
3
+ using System . Diagnostics . CodeAnalysis ;
4
+
5
+ public class HelloWorld
6
+ {
7
+ [ ExcludeFromCodeCoverage ]
8
+ protected HelloWorld ( ) { }
9
+
10
+ public static string Hello ( )
11
+ {
12
+ return "Hello World!" ;
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments