DotNetCore.SKIT.FlurlHttpCl.../test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/TestCase_CodeReviewAnalyzer.cs

70 lines
2.0 KiB
C#
Raw Normal View History

2022-01-21 17:06:31 +08:00
using System.IO;
2021-06-04 21:44:42 +08:00
using System.Reflection;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
{
2022-01-21 16:57:42 +08:00
public class TestCase_CodeReviewAnalyzer
2021-06-04 21:44:42 +08:00
{
2022-01-21 16:57:42 +08:00
private Assembly SourceAssembly { get; } = Assembly.Load("SKIT.FlurlHttpClient.Wechat.Api");
2021-06-04 21:44:42 +08:00
2022-01-21 16:57:42 +08:00
[Fact(DisplayName = "代码评审:分析 API 模型命名")]
public void TestApiModelsNaming()
2021-06-04 21:44:42 +08:00
{
2022-01-21 16:57:42 +08:00
CodeStyleUtil.VerifyApiModelsNaming(SourceAssembly, out var ex);
2021-06-04 21:44:42 +08:00
if (ex != null)
throw ex;
Assert.Null(ex);
}
2022-01-21 16:57:42 +08:00
[Fact(DisplayName = "代码评审:分析 API 模型定义")]
public void TestApiModelsDefinition()
2021-06-04 21:44:42 +08:00
{
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "ModelSamples");
2022-01-21 16:57:42 +08:00
CodeStyleUtil.VerifyApiModelsDefinition(SourceAssembly, workdir, out var ex);
2021-06-04 21:44:42 +08:00
if (ex != null)
throw ex;
Assert.Null(ex);
}
2022-01-21 16:57:42 +08:00
[Fact(DisplayName = "代码评审:分析 API 事件定义")]
public void TestApiEventsDefinition()
2021-06-04 21:44:42 +08:00
{
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "EventSamples");
2022-01-21 16:57:42 +08:00
CodeStyleUtil.VerifyApiEventsDefinition(SourceAssembly, workdir, out var ex);
2021-06-04 21:44:42 +08:00
if (ex != null)
throw ex;
Assert.Null(ex);
}
2022-01-21 16:57:42 +08:00
[Fact(DisplayName = "代码评审:分析 API 接口命名")]
public void TestApiExtensionsNaming()
2021-06-04 21:44:42 +08:00
{
2022-01-21 16:57:42 +08:00
CodeStyleUtil.VerifyApiExtensionsNaming(SourceAssembly, out var ex);
2021-06-04 21:44:42 +08:00
if (ex != null)
throw ex;
Assert.Null(ex);
}
2022-01-21 16:57:42 +08:00
[Fact(DisplayName = "代码评审:分析代码规范")]
public void TestCodeStyle()
{
string workdir = Path.Combine(TestConfigs.ProjectSourceDirectory);
CodeStyleUtil.VerifySourceCodeStyle(workdir, out var ex);
if (ex != null)
throw ex;
Assert.Null(ex);
}
2021-06-04 21:44:42 +08:00
}
}