Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 如何测试总线。延迟()_Unit Testing_Nservicebus - Fatal编程技术网

Unit testing 如何测试总线。延迟()

Unit testing 如何测试总线。延迟(),unit-testing,nservicebus,Unit Testing,Nservicebus,有人知道如何检查(在单元测试中)是否发生了Bus.Defer()?似乎这还不够: Test.Saga<TSaga>(mySaga).ExpectSend < MessageThatIsDeferred >() Test.Saga(mySaga).ExpectSend() 结果是: ExpectedSendInvocation< MessageThatIsDeferred > not fulfilled ExpectedSendInvocation未实现

有人知道如何检查(在单元测试中)是否发生了
Bus.Defer()
?似乎这还不够:

Test.Saga<TSaga>(mySaga).ExpectSend < MessageThatIsDeferred >()
Test.Saga(mySaga).ExpectSend()
结果是:

ExpectedSendInvocation< MessageThatIsDeferred > not fulfilled
ExpectedSendInvocation未实现
电话:

DeferMessageInvocation< MessageThatIsDeferred,System.DateTime >
DeferMessageInvocation

您似乎在使用一个传奇,在这种情况下,您应该调用
RequestTimeout
,请参阅

下面是一个测试传奇超时的示例:

Test.Saga<TimeoutSaga>()
            .ExpectTimeoutToBeSetIn<MyTimeout>()
            .When(saga => saga.Handle(new StartMessage()));
Test.Saga()
.ExpectTimeoutToBestin()
.When(saga=>saga.Handle(newstartMessage());

这有意义吗?

是的,似乎有意义:)。谢谢