【发布时间】:2017-01-09 13:19:40
【问题描述】:
我需要测试我的演员对Terminated 消息的正确反应,我使用TestProbe 来模拟它的孩子。但由于某种原因,我无法阻止TestProbe 演员。这是测试:
[Test]
public void TestProbeStopTest()
{
var probe = CreateTestProbe("Test");
Watch(probe);
Sys.Stop(probe);
ExpectTerminated(probe);
}
这是一个结果:
Failed: Timeout 00:00:03 while waiting for a message of type Akka.Actor.Terminated Terminated Akka.TestKit.TestProbe.
at NUnit.Framework.Assert.Fail(String message, Object[] args)
at Akka.TestKit.TestKitBase.InternalExpectMsgEnvelope[T](Nullable`1 timeout, Action`2 assert, String hint, Boolean shouldLog)
at Akka.TestKit.TestKitBase.InternalExpectMsgEnvelope[T](Nullable`1 timeout, Action`1 msgAssert, Action`1 senderAssert, String hint)
at Akka.TestKit.TestKitBase.InternalExpectMsg[T](Nullable`1 timeout, Action`1 msgAssert, String hint)
at Akka.TestKit.TestKitBase.ExpectTerminated(IActorRef target, Nullable`1 timeout, String hint)
at Actors.Tests.Common.RootActorTests.TestProbeStopTest()
【问题讨论】:
-
请提供方法
CreateTestProbe -
@Phate01,它是Akka.TestKit 框架的一部分 =(
-
我的错误:D 也许这可以帮助你:stackoverflow.com/questions/23946826/…
-
你试过
Sys.Stop(probe.Ref)吗?