From db701da344526e5f4a756470ea30c19fa74f330c Mon Sep 17 00:00:00 2001 From: Argo Date: Mon, 29 Nov 2021 16:49:13 +0000 Subject: [PATCH] =?UTF-8?q?!2154=20doc(#I4KCDS):=20add=20code=20coverage?= =?UTF-8?q?=20badge=20*=20doc:=20=E6=9B=B4=E6=96=B0=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E6=96=87=E6=A1=A3=20*=20doc:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20*=20doc:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3=20*?= =?UTF-8?q?=20revert:=20=E7=A7=BB=E9=99=A4=E5=A4=9A=E8=AF=AD=E8=A8=80=20*?= =?UTF-8?q?=20test:=20=E6=9B=B4=E6=AD=A3=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20*=20revert:=20=E5=A2=9E=E5=8A=A0=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E6=B5=8B=E8=AF=95=20*=20test:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=96=87=E4=BB=B6=20*=20test:=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=B5=8B=E8=AF=95=20*=20te?= =?UTF-8?q?st:=20=E6=9B=B4=E6=96=B0=E9=A1=B9=E7=9B=AE=E8=B7=AF=E5=BE=84=20?= =?UTF-8?q?*=20test:=20=E6=9B=B4=E6=94=B9=E5=91=BD=E4=BB=A4=20*=20chore:?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 11 +++++++++++ BootstrapBlazor.sln | 2 +- README.md | 2 +- README.zh-CN.md | 3 +-- .../BootstrapBlazorZhTestBase .cs | 2 +- ...h-CN.resx => BootstrapBlazorZhTestHost.zh-CN.resx} | 0 test/UnitTest/Core/BootstrapBlazorTestBase.cs | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) rename test/UnitTest.Localization/Resources/{BootstrapBlazorEnTestHost.zh-CN.resx => BootstrapBlazorZhTestHost.zh-CN.resx} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0236ff5bb..982ac6f3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,3 +30,14 @@ jobs: run: | dotnet restore src/BootstrapBlazor --no-cache dotnet build src/BootstrapBlazor + + - name: Test + run: | + dotnet test test/UnitTest -c Release -f net6.0 --collect:"XPlat Code Coverage" -r ./coverage + #dotnet test test/UnitTest.Localization -c Release -f net6.0 --collect:"XPlat Code Coverage" -r ./coverage + + - name: Upload to Codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: ./coverage/ diff --git a/BootstrapBlazor.sln b/BootstrapBlazor.sln index 51c3878a1..ca982e0e1 100644 --- a/BootstrapBlazor.sln +++ b/BootstrapBlazor.sln @@ -113,7 +113,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "middleware", "middleware", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapBlazor.Middleware", "src\Middleware\BootstrapBlazor.Middleware\BootstrapBlazor.Middleware.csproj", "{59B49D4C-05FB-4E51-AB40-9498ADC71DD0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest.Localization", "test\UnitTest.Localization\UnitTest.Localization.csproj", "{99B55645-0E89-43F8-938F-2304B486AD2A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest.Localization", "test\UnitTest.Localization\UnitTest.Localization.csproj", "{99B55645-0E89-43F8-938F-2304B486AD2A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/README.md b/README.md index 002885933..deb9cf96f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Github](https://img.shields.io/github/license/argozhang/bootstrapblazor.svg?logo=git&logoColor=red)](https://github.com/ArgoZhang/BootstrapBlazor/blob/main/LICENSE) [![Repo Size](https://img.shields.io/github/repo-size/ArgoZhang/BootstrapBlazor.svg?logo=github&logoColor=green&label=repo)](https://github.com/ArgoZhang/BootstrapBlazor) [![Commit Date](https://img.shields.io/github/last-commit/ArgoZhang/BootstrapBlazor/main.svg?logo=github&logoColor=green&label=commit)](https://github.com/ArgoZhang/BootstrapBlazor) - +[![codecov](https://codecov.io/gh/dotnetcore/BootstrapBlazor/branch/master/graph/badge.svg?token=5SXIWHXZC3)](https://codecov.io/gh/dotnetcore/BootstrapBlazor) --- diff --git a/README.zh-CN.md b/README.zh-CN.md index cfad09fd7..db77e3e23 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -9,9 +9,8 @@ [![Github](https://img.shields.io/github/license/argozhang/bootstrapblazor.svg?logo=git&logoColor=red)](https://github.com/ArgoZhang/BootstrapBlazor/blob/main/LICENSE) [![Repo Size](https://img.shields.io/github/repo-size/ArgoZhang/BootstrapBlazor.svg?logo=github&logoColor=green&label=repo)](https://github.com/ArgoZhang/BootstrapBlazor) [![Commit Date](https://img.shields.io/github/last-commit/ArgoZhang/BootstrapBlazor/main.svg?logo=github&logoColor=green&label=commit)](https://github.com/ArgoZhang/BootstrapBlazor) - +[![codecov](https://codecov.io/gh/dotnetcore/BootstrapBlazor/branch/master/graph/badge.svg?token=5SXIWHXZC3)](https://codecov.io/gh/dotnetcore/BootstrapBlazor) - --- English | 中文 diff --git a/test/UnitTest.Localization/BootstrapBlazorZhTestBase .cs b/test/UnitTest.Localization/BootstrapBlazorZhTestBase .cs index 948a7a291..fcf8c3c04 100644 --- a/test/UnitTest.Localization/BootstrapBlazorZhTestBase .cs +++ b/test/UnitTest.Localization/BootstrapBlazorZhTestBase .cs @@ -34,7 +34,7 @@ namespace UnitTest.Localization services.AddLocalization(option => option.ResourcesPath = "Resources"); services.AddBootstrapBlazor(localizationAction: options => { - options.ResourceManagerStringLocalizerType = typeof(BootstrapBlazorEnTestHost); + options.ResourceManagerStringLocalizerType = typeof(BootstrapBlazorZhTestHost); }); } diff --git a/test/UnitTest.Localization/Resources/BootstrapBlazorEnTestHost.zh-CN.resx b/test/UnitTest.Localization/Resources/BootstrapBlazorZhTestHost.zh-CN.resx similarity index 100% rename from test/UnitTest.Localization/Resources/BootstrapBlazorEnTestHost.zh-CN.resx rename to test/UnitTest.Localization/Resources/BootstrapBlazorZhTestHost.zh-CN.resx diff --git a/test/UnitTest/Core/BootstrapBlazorTestBase.cs b/test/UnitTest/Core/BootstrapBlazorTestBase.cs index 69b2b658f..98c097b60 100644 --- a/test/UnitTest/Core/BootstrapBlazorTestBase.cs +++ b/test/UnitTest/Core/BootstrapBlazorTestBase.cs @@ -45,7 +45,7 @@ namespace UnitTest.Core ConfigureConfigration(Instance.Services); // 渲染 BootstrapBlazorRoot 组件 激活 ICacheManager 接口 - Instance.RenderTree.Add(); + Instance.Services.GetRequiredService(); } protected virtual void ConfigureServices(IServiceCollection services)