【发布时间】:2021-08-05 16:13:17
【问题描述】:
在以前版本的 MassTransit 中,在编写单元测试时,我曾经通过调用 InMemorySagaRepository.Add() 方法来播种 saga 的初始状态:
private InMemorySagaRepository<TState> Repository { get; }
protected async Task SeedSaga<TState>(TState seedState)
where TState : class, SagaStateMachineInstance
{
await Repository.Add(new SagaInstance<TState>(seedState), default);
}
此方法将在存储库中以所需状态为 saga 添加一个条目,这可以用作我的测试的起点。
现在我升级到了MassTransit的7.2.1版本,这个方法已经不可用了。
是否可以在InMemorySagaRepository 的当前版本中播种数据?如果没有,可以采取什么方法来获得类似的结果?
谢谢。
【问题讨论】:
标签: c# .net unit-testing masstransit