mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-06 16:16:44 +08:00
test(cqrs): 添加 CQRS 分发器缓存功能的单元测试
- 验证相同消息类型重复分发时不会重复扩张服务类型与调用委托缓存 - 验证 request 调用委托会按响应类型分别缓存避免不同响应类型共用 object 结果桥接 - 实现通过反射读取 dispatcher 静态缓存字典的测试辅助方法 - 添加清空 dispatcher 静态缓存的方法避免跨用例共享进程级状态 - 创建多个测试数据模型和处理器用于验证不同的缓存场景 - 实现异步流消费方法确保建流路径被真实执行
This commit is contained in:
parent
73b63777ce
commit
31b6285bbd
@ -12,6 +12,9 @@ namespace GFramework.Cqrs.Tests.Cqrs;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
internal sealed class CqrsDispatcherCacheTests
|
internal sealed class CqrsDispatcherCacheTests
|
||||||
{
|
{
|
||||||
|
private MicrosoftDiContainer? _container;
|
||||||
|
private ArchitectureContext? _context;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化测试上下文。
|
/// 初始化测试上下文。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -42,9 +45,6 @@ internal sealed class CqrsDispatcherCacheTests
|
|||||||
_container = null;
|
_container = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MicrosoftDiContainer? _container;
|
|
||||||
private ArchitectureContext? _context;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证相同消息类型重复分发时,不会重复扩张服务类型与调用委托缓存。
|
/// 验证相同消息类型重复分发时,不会重复扩张服务类型与调用委托缓存。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -165,6 +165,7 @@ internal sealed class CqrsDispatcherCacheTests
|
|||||||
GetGenericCacheField("RequestInvokerCache`1", typeof(int), "Invokers").Clear();
|
GetGenericCacheField("RequestInvokerCache`1", typeof(int), "Invokers").Clear();
|
||||||
GetGenericCacheField("RequestInvokerCache`1", typeof(string), "Invokers").Clear();
|
GetGenericCacheField("RequestInvokerCache`1", typeof(string), "Invokers").Clear();
|
||||||
GetGenericCacheField("RequestPipelineInvokerCache`1", typeof(int), "Invokers").Clear();
|
GetGenericCacheField("RequestPipelineInvokerCache`1", typeof(int), "Invokers").Clear();
|
||||||
|
GetGenericCacheField("RequestPipelineInvokerCache`1", typeof(string), "Invokers").Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user