mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-07-04 17:48:15 +08:00
refactor: ♻️ 框架&业务代码分离 (#185)
Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
131
src/backend/UnitTests/Sys/ConfigTests.cs
Normal file
131
src/backend/UnitTests/Sys/ConfigTests.cs
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user