2021-06-11 21:20:02 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace SKIT.FlurlHttpClient.Wechat.Ads.UnitTests
|
|
|
|
|
{
|
|
|
|
|
public class WechatAdsDeclarationTests
|
|
|
|
|
{
|
|
|
|
|
private static readonly Assembly _assembly = Assembly.Load("SKIT.FlurlHttpClient.Wechat.Ads");
|
|
|
|
|
|
|
|
|
|
[Fact(DisplayName = "验证 API 模型命名")]
|
|
|
|
|
public void ApiModelsNamingTest()
|
|
|
|
|
{
|
2021-08-16 15:25:06 +08:00
|
|
|
|
CodeStyleUtil.VerifyApiModelsNaming(_assembly, out var ex);
|
2021-06-11 21:20:02 +08:00
|
|
|
|
|
|
|
|
|
if (ex != null)
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
|
|
Assert.Null(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact(DisplayName = "验证 API 模型定义")]
|
|
|
|
|
public void ApiModelsDefinitionTest()
|
|
|
|
|
{
|
|
|
|
|
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "ModelSamples");
|
2021-08-16 15:25:06 +08:00
|
|
|
|
CodeStyleUtil.VerifyApiModelsDefinition(_assembly, workdir, out var ex);
|
2021-06-11 21:20:02 +08:00
|
|
|
|
|
|
|
|
|
if (ex != null)
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
|
|
Assert.Null(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact(DisplayName = "验证 API 接口命名")]
|
|
|
|
|
public void ApiExtensionsNamingTest()
|
|
|
|
|
{
|
2021-08-16 15:25:06 +08:00
|
|
|
|
CodeStyleUtil.VerifyApiExtensionsNaming(_assembly, out var ex);
|
2021-06-11 21:20:02 +08:00
|
|
|
|
|
|
|
|
|
if (ex != null)
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
|
|
Assert.Null(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact(DisplayName = "验证代码规范")]
|
|
|
|
|
public void CodeStyleTest()
|
|
|
|
|
{
|
|
|
|
|
string workdir = Path.Combine(TestConfigs.ProjectSourceDirectory);
|
2021-08-16 15:25:06 +08:00
|
|
|
|
CodeStyleUtil.VerifySourceCodeStyle(workdir, out var ex);
|
2021-06-11 21:20:02 +08:00
|
|
|
|
|
|
|
|
|
if (ex != null)
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
|
|
Assert.Null(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|