mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 23:13:32 +08:00
test: 修复检测工具的一处边界问题
This commit is contained in:
parent
5522bb49b7
commit
0076cacb0c
@ -27,8 +27,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
// NOTICE: 注意 URL 结尾的反斜杠不能删除
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "applyment4sub", "applyment/"); // NOTICE: 注意 URL 结尾的反斜杠不能删除
|
||||
.CreateRequest(request, HttpMethod.Post, "applyment4sub", "applyment/");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateApplyForSubMerchantApplymentResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Ads.UnitTests
|
||||
[Fact(DisplayName = "验证 API 模型命名")]
|
||||
public void ApiModelsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -30,7 +30,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Ads.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "ModelSamples");
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -41,7 +41,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Ads.UnitTests
|
||||
[Fact(DisplayName = "验证 API 接口命名")]
|
||||
public void ApiExtensionsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -55,7 +55,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Ads.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectSourceDirectory);
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
CodeStyleUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
|
@ -16,7 +16,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
[Fact(DisplayName = "验证 API 模型命名")]
|
||||
public void ApiModelsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -30,7 +30,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "ModelSamples");
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -44,7 +44,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "EventSamples");
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifyApiEventsDefinition(_assembly, workdir, out var ex);
|
||||
CodeStyleUtil.VerifyApiEventsDefinition(_assembly, workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -55,7 +55,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
[Fact(DisplayName = "验证 API 接口命名")]
|
||||
public void ApiExtensionsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectSourceDirectory);
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
CodeStyleUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
|
@ -16,7 +16,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
[Fact(DisplayName = "验证 API 模型命名")]
|
||||
public void ApiModelsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -30,7 +30,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "ModelSamples");
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -44,7 +44,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "EventSamples");
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifyApiEventsDefinition(_assembly, workdir, out var ex);
|
||||
CodeStyleUtil.VerifyApiEventsDefinition(_assembly, workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -55,7 +55,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
[Fact(DisplayName = "验证 API 接口命名")]
|
||||
public void ApiExtensionsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectSourceDirectory);
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
CodeStyleUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
|
@ -9,7 +9,7 @@ using System.Xml.Serialization;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat
|
||||
{
|
||||
public static class TestAssertUtil
|
||||
public static class CodeStyleUtil
|
||||
{
|
||||
private static bool TryJsonize(string json, Type type, out Exception exception)
|
||||
{
|
||||
@ -400,8 +400,8 @@ namespace SKIT.FlurlHttpClient.Wechat
|
||||
{
|
||||
for (int urlSegmentIndex = 0; urlSegmentIndex < expectedUrlSegments.Length; urlSegmentIndex++)
|
||||
{
|
||||
string expectedUrlSegment = expectedUrlSegments[urlSegmentIndex];
|
||||
string actualUrlSegment = actualUrlSegments[urlSegmentIndex];
|
||||
string expectedUrlSegment = expectedUrlSegments[urlSegmentIndex].Trim('/');
|
||||
string actualUrlSegment = actualUrlSegments[urlSegmentIndex].Trim('/');
|
||||
if (expectedUrlSegment.Contains("{"))
|
||||
{
|
||||
if (actualUrlSegment.StartsWith("\""))
|
||||
@ -412,7 +412,7 @@ namespace SKIT.FlurlHttpClient.Wechat
|
||||
}
|
||||
else
|
||||
{
|
||||
actualUrlSegment = actualUrlSegment.Replace("\"", string.Empty);
|
||||
actualUrlSegment = actualUrlSegment.Replace("\"", string.Empty).Trim('/');
|
||||
if (!string.Equals(expectedUrlSegment, actualUrlSegment))
|
||||
{
|
||||
lstError.Add(new Exception($"源代码 \"{extCodeFileName}\" 下第 {i + 1} 段文档注释有误,`[{expectedMethod}] {expectedUrl}` 与实际接口路由不一致。"));
|
@ -16,7 +16,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests
|
||||
[Fact(DisplayName = "验证 API 模型命名")]
|
||||
public void ApiModelsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -30,7 +30,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "ModelSamples");
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
CodeStyleUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -44,7 +44,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "EventSamples");
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifyApiEventsDefinition(_assembly, workdir, out var ex);
|
||||
CodeStyleUtil.VerifyApiEventsDefinition(_assembly, workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -55,7 +55,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests
|
||||
[Fact(DisplayName = "验证 API 接口命名")]
|
||||
public void ApiExtensionsNamingTest()
|
||||
{
|
||||
TestAssertUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
CodeStyleUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests
|
||||
string workdir = Path.Combine(TestConfigs.ProjectSourceDirectory);
|
||||
Assert.True(Directory.Exists(workdir));
|
||||
|
||||
TestAssertUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
CodeStyleUtil.VerifySourceCodeStyle(workdir, out var ex);
|
||||
|
||||
if (ex != null)
|
||||
throw ex;
|
||||
|
Loading…
Reference in New Issue
Block a user