refactor: ♻️ 框架&业务代码分离 (#185)

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
2024-11-04 12:06:50 +08:00
committed by GitHub
parent 072cc1e491
commit 13ba536df2
404 changed files with 4579 additions and 1283 deletions

View File

@ -0,0 +1,131 @@
using NetAdmin.SysComponent.Domain.Dto.Sys.Config;
namespace UnitTests.Sys;
/// <summary>
/// 配置测试
/// </summary>
[SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")]
[SuppressMessage("Usage", "xUnit1028:Test method must have valid return type")]
public class ConfigTests(WebTestApplicationFactory<Startup> factory, ITestOutputHelper testOutputHelper)
: WebApiTestBase<Startup>(factory, testOutputHelper), IConfigModule
{
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<int> BulkDeleteAsync(BulkReq<DelReq> req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<long> CountAsync(QueryReq<QueryConfigReq> req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<QueryConfigRsp> CreateAsync(CreateConfigReq req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<int> DeleteAsync(DelReq req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<QueryConfigRsp> EditAsync(EditConfigReq req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<bool> ExistAsync(QueryReq<QueryConfigReq> req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<IActionResult> ExportAsync(QueryReq<QueryConfigReq> req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<QueryConfigRsp> GetAsync(QueryConfigReq req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[Fact]
public async Task<QueryConfigRsp> GetLatestConfigAsync()
{
var rsp = await PostJsonAsync(typeof(ConfigController));
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<PagedQueryRsp<QueryConfigRsp>> PagedQueryAsync(PagedQueryReq<QueryConfigReq> req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<IEnumerable<QueryConfigRsp>> QueryAsync(QueryReq<QueryConfigReq> req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
/// <inheritdoc />
[InlineData(default)]
[Theory]
public async Task<int> SetEnabledAsync(SetConfigEnabledReq req)
{
var rsp = await PostJsonAsync(typeof(ConfigController), req);
Assert.True(rsp.IsSuccessStatusCode);
return default;
}
}