Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.1.3 #815

Merged
merged 18 commits into from
Dec 24, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update UT script
RayWangQvQ committed May 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 6feacf714c48a09d725f931c08c7055ae4bad85c
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -368,4 +368,7 @@ krew/pkg/utils/fixtures
kustomization.yaml

# cookie config
**/Ray.BiliBiliTool.Console/cookies.json
**/Ray.BiliBiliTool.Console/cookies.json

# ut
coveragereport
11 changes: 10 additions & 1 deletion Ray.BiliBiliTool.sln
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitignore = .gitignore
CHANGELOG.md = CHANGELOG.md
clean.cmd = clean.cmd
common.props = common.props
Dockerfile = Dockerfile
LICENSE = LICENSE
@@ -139,6 +138,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfrastructureTest", "test\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ray.BiliBiliTool.Agent.FunctionalTests", "test\Ray.BiliBiliTool.Agent.FunctionalTests\Ray.BiliBiliTool.Agent.FunctionalTests.csproj", "{16F315CF-056A-4B08-8C3C-A3177EA3CBB9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{2B5FD099-CC28-4FBC-9F20-F20300C5DFD2}"
ProjectSection(SolutionItems) = preProject
scripts\clean.cmd = scripts\clean.cmd
scripts\publish.bat = scripts\publish.bat
scripts\publish.ps1 = scripts\publish.ps1
scripts\publish.sh = scripts\publish.sh
scripts\ut.ps1 = scripts\ut.ps1
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -233,6 +241,7 @@ Global
{26B21C30-7358-4E7B-A73E-2272F10A6CA8} = {E9BDDCBE-A57D-4E3B-8252-708088386ADF}
{90C1DB73-B3DB-4BE5-AD1A-5248FE47860E} = {E9BDDCBE-A57D-4E3B-8252-708088386ADF}
{16F315CF-056A-4B08-8C3C-A3177EA3CBB9} = {E9BDDCBE-A57D-4E3B-8252-708088386ADF}
{2B5FD099-CC28-4FBC-9F20-F20300C5DFD2} = {F3DE0D72-426B-4AD9-B3ED-3343CF4223F1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {197319DA-1148-4A99-847C-8B270B6A29AB}
14 changes: 8 additions & 6 deletions scripts/ut.ps1
Original file line number Diff line number Diff line change
@@ -6,12 +6,14 @@ dotnet tool install -g dotnet-reportgenerator-globaltool

# 杩愯鍗曞厓娴嬭瘯骞剁敓鎴愯鐩栫巼鎶ュ憡
Write-Output "Running unit tests and generating coverage report..."
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.opencover.xml

# 鐢熸垚 HTML 鏍煎紡鐨勮鐩栫巼鎶ュ憡
Write-Output "Generating HTML coverage report..."
reportgenerator "-reports:TestResults/*/coverage.opencover.xml" "-targetdir:coveragereport" -reporttypes:Html
# 鐢熸垚html鎶ュ憡
$coverageFiles = Get-ChildItem -Path . -Recurse -Filter "coverage.cobertura.xml"
$coverageFiles | ForEach-Object { Write-Output $_.FullName }
$reportPaths = ($coverageFiles | ForEach-Object { $_.FullName }) -join ";"
reportgenerator "-reports:$reportPaths" "-targetdir:coveragereport" -reporttypes:Html

# 鎵撳紑鐢熸垚鐨勮鐩栫巼鎶ュ憡
Write-Output "Opening coverage report..."
# 妫�鏌ョ敓鎴愮殑瑕嗙洊鐜囨姤鍛婃枃浠舵槸鍚﹀瓨鍦�
Write-Output "Coverage report generated successfully."
Start-Process "coveragereport/index.htm"
2 changes: 0 additions & 2 deletions test/AppServiceTest/DailyTask/DonateCoinsTest.cs
Original file line number Diff line number Diff line change
@@ -17,8 +17,6 @@ public void Test1()
{
using var scope = Global.ServiceProviderRoot.CreateScope();
var appService = scope.ServiceProvider.GetRequiredService<IDailyTaskAppService>();


}
}
}
35 changes: 0 additions & 35 deletions test/BiliAgentTest/HomeApiTest.cs

This file was deleted.

2 changes: 1 addition & 1 deletion test/InfrastructureTest/WbiHelperTest.cs
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ public void Replace_Test()
string output = Regex.Replace(input, pattern, replacement);
Debug.WriteLine(output);

Assert.Equal(output, "这是一段包含特殊字符@#$%^&的字符串");
Assert.Equal("这是一段包含特殊字符@#$%^&的字符串", output);
}
}
}
46 changes: 23 additions & 23 deletions test/LogTest/TestCoolPush.cs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions test/LogTest/TestDingTalk.cs
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ public class TestDingTalk
public TestDingTalk()
{
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
Program.CreateHost(new string[] { });
Program.CreateHost(new string[] { "ENVIRONMENT=Development" });

_key = Global.ConfigurationRoot["Serilog:WriteTo:5:Args:webHookUrl"];
}
@@ -30,9 +30,10 @@ public void Test2()
{
var client = new DingTalkApiClient(_key);

var title = "杩欐槸鏍囬";
var msg = LogConstants.Msg2 + "寮�濮嬫帹閫�";

var result = client.PushMessage(msg);
var result = client.PushMessage(msg, title);
Debug.WriteLine(result.Content.ReadAsStringAsync().Result);
}
}
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
using Ray.BiliBiliTool.Infrastructure.Cookie;
using Xunit;
using Ray.BiliBiliTool.Agent.BiliBiliAgent.Services;
using FluentAssertions;

namespace BiliAgentTest
{
@@ -116,11 +117,15 @@ public void WearMedalWall_Normal_Success()
var biliCookie = scope.ServiceProvider.GetRequiredService<BiliCookie>();

// 鐚浄绮変笣鐗�
var request = new WearMedalWallRequest(biliCookie.BiliJct, 365421);
var request = new WearMedalWallRequest(biliCookie.BiliJct, 365421); //todo

BiliApiResponse re = api.WearMedalWall(request).Result;

Assert.True(re.Code == 0);
re.Code.Should().BeOneOf(
0,
1500005
);
}

[Fact]