Particular / NServiceBus.Testing

A framework for composing tests for NServiceBus
https://docs.particular.net/nservicebus/testing/
Other
9 stars 10 forks source link

Cannot use new Saga Scenario testing framework when Saga is derived from SqlSaga<TSagaData> #365

Closed HScheenen closed 2 years ago

HScheenen commented 2 years ago

A saga that is derived from SqlSaga cannot be tested using the new Saga Scenario testing framework. The problem is that TestableSaga<TSaga, TSagaData> has a type constraint on TSaga which requires that TSaga is derived from NServiceBus.Saga. Unfortunately, SqlSaga derives from NServiceBus.Saga, making it impossible to fulfill the type constraint on TSaga.

Making SqlSaga in NServiceBus.Persistence.Sql derive from Saga would fix this problem. However, that could be a breaking change in NServiceBus.Persistence.Sql.

danielmarbach commented 2 years ago

Hi Herman,

Thanks for reaching out and letting us know about the shortcoming. Can you elaborate why you are using SqlSaga in those specific cases? As far as I'm aware, it is actually not required to use SqlSaga as a base class anymore. We have lifted the constraints mostly.

SqlSaga is an alternate saga base class for use with SQL persistence that offers a less verbose mapping API than NServiceBus.Saga. It's generally advisable to use NServiceBus.Saga by default for most new projects

https://docs.particular.net/persistence/sql/sqlsaga

Regards, Daniel

HScheenen commented 2 years ago

Hi Daniel,

Thanks for your quick reply. Sometimes the solution is just too obvious! We have no special reason to use SqlSaga as a base class, other than "that's how we always did it in the past". We'll change to Saga .

Regards, Herman