akkadotnet/akka.net — pull request #388 by HCanber (2014-09-10 18:22:11+00:00)
Title: Add ImplicitSender to TestKit

When a test class (one that inherits TestKit or AkkkaSpec) implements the interface `ImplicitSender` then `TestActor` is used as implicit sender.
Example from this PR:
```C#
public class ImplicitSenderSpec : AkkaSpec, ImplicitSender
{
[Fact]
public void ImplicitSender_should_have_testActor_as_sender()
{
var echoActor = Sys.ActorOf(c => c.ReceiveAny((m, ctx) => TestActor.Tell(ctx.Sender))); //Tell TestActor who the Sender wass
echoActor.Tell("message");
ExpectMsg(actorRef => actorRef == TestActor);
}
}
```

This PR has been split in two commits. One that makes changes to Core Akka, and one that adds new functionality to TestKit.

To make this work I moved the thread static current ActorCell (which is used to get the current context from) out of `ActorCell` into a new class and make it possible to manually set the context. Commit https://github.com/HCanber/akka.net/commit/cda5c9f0c829e025f776ba736284c483ee478446

Then, when ActorKit is created if it implements `ImplicitSender` (an empty marker interface) it sets the context to `TestActor`'s `ActorCell`. Commit https://github.com/HCanber/akka.net/commit/bc487ae267f367bc40372e5f0572042d812fc47d