Skip to content

Commit

Permalink
update UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
RayWangQvQ committed May 20, 2024
1 parent e772d3c commit 0e2d15c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 36 deletions.
2 changes: 2 additions & 0 deletions test/LogTest/LogTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

<UserSecretsId>5bc79f80-380e-4bcf-9c0b-30e98db3b935</UserSecretsId>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions test/LogTest/TestCoolPush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public void Test2()
CoolPushApiClient client = new CoolPushApiClient(_key);
var result = client.PushMessage(msg8);
Debug.WriteLine(result.Content.ReadAsStringAsync().Result);

System.Console.ReadLine();
}
}
}
2 changes: 0 additions & 2 deletions test/LogTest/TestDingTalk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public void Test2()

var result = client.PushMessage(msg);
Debug.WriteLine(result.Content.ReadAsStringAsync().Result);

System.Console.ReadLine();
}
}
}
2 changes: 1 addition & 1 deletion test/LogTest/TestMicrosoftTeams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class TestMicrosoftTeams
public TestMicrosoftTeams()
{
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
Program.CreateHost(new string[] { });
Program.CreateHost(new string[] { "ENVIRONMENT=Development" });

_webhook = Global.ConfigurationRoot["Serilog:WriteTo:10:Args:webhook"];
}
Expand Down
2 changes: 0 additions & 2 deletions test/LogTest/TestPushPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public void Test2()

var result = client.PushMessage(msg);
Debug.WriteLine(result.Content.ReadAsStringAsync().Result);

System.Console.ReadLine();
}
}
}
6 changes: 3 additions & 3 deletions test/LogTest/TestWorkWeiXin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ public class TestWorkWeiXin

public TestWorkWeiXin()
{
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
Program.CreateHost(new string[] { });
Environment.SetEnvironmentVariable("DOTNET_ENVIRONMENT", "Development");
Program.CreateHost(new string[] { "ENVIRONMENT=Development" });

_key = Global.ConfigurationRoot["Serilog:WriteTo:4:Args:webHookUrl"];
}

[Fact]
public void Test2()
{
WorkWeiXinApiClient client = new WorkWeiXinApiClient(_key);
var client = new WorkWeiXinApiClient(_key);

//string msg = LogConstants.Msg;
string msg = LogConstants.Msg2;
Expand Down
3 changes: 0 additions & 3 deletions test/LogTest/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public void Test1()

logger.LogDebug(null);
logger.LogDebug("123{0}{1}", null, "haha");

System.Console.ReadLine();
}

[Fact]
Expand All @@ -53,7 +51,6 @@ public void Test2()
logger.LogInformation("-----全部任务已执行结束-----\r\n");

logger.LogInformation("开始推送");
System.Console.ReadLine();
}

private ILogger CreateLogger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ public async Task AddCoinForArticleAsync_Normal_Success()
BiliBiliAgent.Dtos.BiliApiResponse re = await _api.AddCoinForArticleAsync(req);

// Assert
re.Code.Should().Be(0);
re.Message.Should().BeEquivalentTo("0");
re.Code.Should().BeOneOf(
0,// 成功
34005 // 超过投币上限啦~
);
}

#endregion
Expand Down
22 changes: 4 additions & 18 deletions test/Ray.BiliBiliTool.Agent.FunctionalTests/ChargeApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,16 @@ public async void ChargeV2Async_SendRequest_NotEnough()

// Assert
re.Code.Should().Be(0);
re.Data.Status.Should().Be(-4);
re.Data.Msg.Should().BeEquivalentTo("bp.to.battery http failed, invalid args, errNo=800409904: B ±ÒÓà¶î²»×ã");
re.Data.Status.Should().BeOneOf(
-4,//bp.to.battery http failed, invalid args, errNo=800409904: B ±ÒÓà¶î²»×ã
4
);
}

#endregion

#region ChargeCommentAsync

[Fact]
public async void ChargeCommentAsync_SendRequest_SetWridSuccess()
{
// Arrange
var upId = 220893216;
var req = new ChargeRequest(2, upId, _ck.BiliJct);

// Act
BiliApiResponse<ChargeV2Response> re = await _target.ChargeV2Async(req);

// Assert
re.Code.Should().Be(0);
re.Data.Status.Should().Be(-4);
re.Data.Msg.Should().BeEquivalentTo("bp.to.battery http failed, invalid args, errNo=800409904: B ±ÒÓà¶î²»×ã");
}

#endregion

}
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public async Task ReceiveVipPrivilege_Normal_Success()
// Arrange

// Assert
re.Code.Should().BeOneOf(new List<int>
{
re.Code.Should().BeOneOf(
0,
73319, //todo: sort out meannings
});
69801 //你已领取过该权益
);
}
}

0 comments on commit 0e2d15c

Please sign in to comment.