2026-01-28 19:32:11 +08:00
|
|
|
|
namespace WebApi.Test.Repository;
|
2026-01-28 17:00:58 +08:00
|
|
|
|
|
|
|
|
|
|
public class ConfigRepositoryTest : RepositoryTestBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly IConfigRepository _repository;
|
|
|
|
|
|
|
|
|
|
|
|
public ConfigRepositoryTest()
|
|
|
|
|
|
{
|
|
|
|
|
|
_repository = new ConfigRepository(FreeSql);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
public async Task GetByKeyAsync_获取配置_Test()
|
|
|
|
|
|
{
|
|
|
|
|
|
await _repository.AddAsync(new ConfigEntity { Key = "k1", Value = "v1" });
|
2026-01-30 10:41:19 +08:00
|
|
|
|
|
2026-01-28 17:00:58 +08:00
|
|
|
|
var config = await _repository.GetByKeyAsync("k1");
|
|
|
|
|
|
config.Should().NotBeNull();
|
2026-01-28 19:32:11 +08:00
|
|
|
|
config.Value.Should().Be("v1");
|
2026-01-28 17:00:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|