akkadotnet/akka.net — pull request #214 by HCanber (2014-07-16 11:36:26+00:00)
Title: Restructure and refactor Testkit

This fixes #182. Needs discussion before merging.
Requires #213 to be merged.

This contains **MANY** breaking changes.

*Some* of the breaking changes:
- `AkkaSpec` is no longer part of the public TestKit. It's only used internally and has been moved to a new Akka.Tests.Shared.Internals.
- Most of the stuff in `AkkaSpec` has been moved to `TestKitBase`, which the new xUnit TestKit inherits from.
- Members are now in PascalCase
- `TestActor` runs synchronously using `SingleThreadDispatcher`
- Namespace changes (things were in wrong namespaces)
- `ActorRefFactory.ActorOf`returns `ActorRef` (used to return `InternalActorRef`)
- `ActorSystem` is now an abstract class, and belongs to the public api, with `InternalActorSystem` being the internal concrete class. Extensions receives `ExtendedActorSystem`
- Removed test-transport`from `pigeon.conf`, that was ok, right?

Non breaking changes (I hope)
- Had to tweak HoconConfig a bit since it didn't allow chaining many `WithFallback` after each other. Support for parsing "ms" in `GetMillisDuration()`
- Added logging to `FSM` controlled by config "akka.actor.debug.fsm" (was needed during debug of why tests failed)

Could someone that knows F# (@Horusiath ?) check the change in FsApi.cs:
``` F#
was: let serializer = new Serialization.ExprSerializer(system)
now: let serializer = new Serialization.ExprSerializer(system :?> ExtendedActorSystem)
```

### Discussion
Akka Jvm has `expectMsg` and `expectMsgPF`. The latter takes a partial function, hence the PF in the name. Since we don't have partial functions I created a overload of `ExpectMsg` that takes a predicate that returns true if the message matches.
- Have a look at the api of `TestKitBase`. These are exposed by all TestKits (we only have one for xUnit right now). Does it look ok? Too few, too many overloads? I tried to document everything.
- I just realized that some of the members in `TestKitBase` are protected while some are public, for example the `Sys` property is public while the `ExpectMsg` overloads are protected. They should be the same. Protected or public? I'm voting for public.
- Maybe we should look a bit more at our Hocon implementation, as it's missing things. The [original code](https://github.com/typesafehub/config) is written in java so it should be straight forward. Maybe create a separate project under akkadotnet and pull it in as nuget package?