我正在使用 NUnit 进行测试。我究竟做错了什么?
public class ZipActor : ReceiveActor
{
public ZipActor()
{
Receive<ZipMessage>(message => HandleZipMessage(message));
}
private void HandleZipMessage(ZipMessage message)
{
Console.WriteLine(string.Format("Received: {0} for {1}", typeof(ZipMessage).Name, message.SourceFolderPath));
}
}
public class ZipMessage
{
public readonly string SourceFolderPath;
public ZipMessage(string sourceFolderPath)
{
SourceFolderPath = sourceFolderPath;
}
}
[TestFixture]
public class ZipActorTests : TestKit
{
[Test]
public void ZipActor_WhenSentZipMessage_ShouldReceiveZipMessage()
{
var actor = Sys.ActorOf(Props.Create(() => new ZipActor()));
string path = "some path";
actor.Tell(new ZipMessage(path));
ExpectMsg<ZipMessage>();
}
}
我收到此错误:
失败:等待 CloudBackupActors.Messages.ZipMessage 类型的消息时超时 00:00:03
这就是我在 NUnit 的控制台输出中得到的。收到:ZipMessage for some path [WARNING][16/11/2015 18:46:37][Thread 0012][akka://test/user] DeadLetter from [akka://test/user] to [akka:/ /test/user]: : [akka://test/user/$b], ExistenceConfirmed=True, AddressTerminated=False>