Skip to content

Commit 4ddec08

Browse files
committed
Update test.yml
1 parent aeb44cf commit 4ddec08

File tree

7 files changed

+549
-373
lines changed

7 files changed

+549
-373
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ jobs:
1818
with:
1919
dotnet-version: 8.x
2020
- name: Test
21-
run: dotnet test
21+
run: dotnet test --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
2222
- name: Upload coverage reports to Codecov
2323
uses: codecov/codecov-action@v4
2424
with:
2525
token: ${{ secrets.CODECOV_TOKEN }}
26+
file: coverage.cobertura.xml
27+
directory: tests/Translator.UnitTests

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,8 @@ MigrationBackup/
352352
# appsettings
353353
/**/appsettings.Local.json
354354

355-
*.exe
355+
*.exe
356+
357+
# coverlet
358+
coverage.cobertura.xml
359+
/coveragereport

coverage.xml

Lines changed: 0 additions & 353 deletions
This file was deleted.

src/Translator/TranslatorParser.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace Translator;
44

5-
public partial class TranslatorParser(ITranslatorLoader loader) : ITranslatorParser
5+
public class TranslatorParser(ITranslatorLoader loader) : ITranslatorParser
66
{
7-
[GeneratedRegex(@"^(?<key>\w+) = (?<value>\w+)$")]
8-
private static partial Regex TranslatorRegex();
7+
private static readonly Regex TranslatorRegex = new(@"^(?<key>\w+) = (?<value>\w+)$");
98

109
private readonly string[] _lines = loader.GetLines();
1110

@@ -20,12 +19,10 @@ public Dictionary<string, List<string>> GetTranslations()
2019
return translator;
2120
}
2221

23-
var regex = TranslatorRegex();
24-
2522
for (var i = 1; i < _lines.Length; i++)
2623
{
2724
var line = _lines[i];
28-
var match = regex.Match(line);
25+
var match = TranslatorRegex.Match(line);
2926

3027
if (!match.Success)
3128
{

tdd.sln

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ VisualStudioVersion = 17.8.34330.188
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Translator", "src\Translator\Translator.csproj", "{52139E0B-76D9-4A6E-8812-637FC3AA900C}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Translator.UnitTests", "tests\Translator.UnitTests\Translator.UnitTests.csproj", "{9F343BBB-F64E-4C69-81F3-034AC63D7601}"
9-
EndProject
108
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5D76365D-C61A-4EB7-9487-AE5A120FBEAD}"
119
EndProject
1210
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{5FE0CDB1-C4BF-4A8C-A5DF-4623C2191BB8}"
@@ -15,8 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data", "data", "{27AA1641-D
1513
ProjectSection(SolutionItems) = preProject
1614
data\translator-empty.txt = data\translator-empty.txt
1715
data\translator-erroneous.txt = data\translator-erroneous.txt
18-
data\translator.txt = data\translator.txt
1916
data\translator-name.txt = data\translator-name.txt
17+
data\translator.txt = data\translator.txt
2018
EndProjectSection
2119
EndProject
2220
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{F8C0CF9F-5BDC-44E2-A941-12C3633C257C}"
@@ -34,6 +32,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
3432
.github\workflows\test.yml = .github\workflows\test.yml
3533
EndProjectSection
3634
EndProject
35+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Translator.UnitTests", "tests\Translator.UnitTests\Translator.UnitTests.csproj", "{6F9F0448-6AB1-424C-8EA8-D1B1A93FC3E2}"
36+
EndProject
3737
Global
3838
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3939
Debug|Any CPU = Debug|Any CPU
@@ -44,18 +44,18 @@ Global
4444
{52139E0B-76D9-4A6E-8812-637FC3AA900C}.Debug|Any CPU.Build.0 = Debug|Any CPU
4545
{52139E0B-76D9-4A6E-8812-637FC3AA900C}.Release|Any CPU.ActiveCfg = Release|Any CPU
4646
{52139E0B-76D9-4A6E-8812-637FC3AA900C}.Release|Any CPU.Build.0 = Release|Any CPU
47-
{9F343BBB-F64E-4C69-81F3-034AC63D7601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48-
{9F343BBB-F64E-4C69-81F3-034AC63D7601}.Debug|Any CPU.Build.0 = Debug|Any CPU
49-
{9F343BBB-F64E-4C69-81F3-034AC63D7601}.Release|Any CPU.ActiveCfg = Release|Any CPU
50-
{9F343BBB-F64E-4C69-81F3-034AC63D7601}.Release|Any CPU.Build.0 = Release|Any CPU
47+
{6F9F0448-6AB1-424C-8EA8-D1B1A93FC3E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48+
{6F9F0448-6AB1-424C-8EA8-D1B1A93FC3E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
49+
{6F9F0448-6AB1-424C-8EA8-D1B1A93FC3E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
50+
{6F9F0448-6AB1-424C-8EA8-D1B1A93FC3E2}.Release|Any CPU.Build.0 = Release|Any CPU
5151
EndGlobalSection
5252
GlobalSection(SolutionProperties) = preSolution
5353
HideSolutionNode = FALSE
5454
EndGlobalSection
5555
GlobalSection(NestedProjects) = preSolution
5656
{52139E0B-76D9-4A6E-8812-637FC3AA900C} = {5D76365D-C61A-4EB7-9487-AE5A120FBEAD}
57-
{9F343BBB-F64E-4C69-81F3-034AC63D7601} = {5FE0CDB1-C4BF-4A8C-A5DF-4623C2191BB8}
5857
{8507BD5C-4414-427A-B643-2C985C3C50AF} = {125A5AA8-993C-454A-9307-6283CF5AAF34}
58+
{6F9F0448-6AB1-424C-8EA8-D1B1A93FC3E2} = {5FE0CDB1-C4BF-4A8C-A5DF-4623C2191BB8}
5959
EndGlobalSection
6060
GlobalSection(ExtensibilityGlobals) = postSolution
6161
SolutionGuid = {9524A492-B719-4E0A-817F-6D0F639F1516}

tests/Translator.UnitTests/Translator.UnitTests.csproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,25 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13+
<PackageReference Include="coverlet.msbuild" Version="6.0.1">
14+
<PrivateAssets>all</PrivateAssets>
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16+
</PackageReference>
1317
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
1418
<PackageReference Include="Moq" Version="4.20.70" />
1519
<PackageReference Include="xunit" Version="2.7.0" />
1620
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
17-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1821
<PrivateAssets>all</PrivateAssets>
19-
</PackageReference>
20-
<PackageReference Include="coverlet.collector" Version="6.0.1">
2122
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22-
<PrivateAssets>all</PrivateAssets>
2323
</PackageReference>
2424
</ItemGroup>
2525

2626
<ItemGroup>
2727
<ProjectReference Include="..\..\src\Translator\Translator.csproj" />
2828
</ItemGroup>
2929

30+
<ItemGroup>
31+
<Using Include="Xunit" />
32+
</ItemGroup>
33+
3034
</Project>

0 commit comments

Comments
 (0)