Skip to content

Instantly share code, notes, and snippets.

@Danthar
Created September 15, 2016 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Danthar/8d8b9900f991024209972dc387b2f76d to your computer and use it in GitHub Desktop.
Save Danthar/8d8b9900f991024209972dc387b2f76d to your computer and use it in GitHub Desktop.
public static class SerializerTestHelpers
{
public static async Task<T> AkkaSerialized<T>(this T src)
{
var hocon = "akka.actor.provider = \"Akka.Remote.RemoteActorRefProvider, Akka.Remote\"" +
Environment.NewLine +
"akka.remote.helios.tcp.port = 0" + Environment.NewLine +
"akka.remote.helios.tcp.hostname = localhost";
var sys = ActorSystem.Create("src");//, ConfigurationFactory.ParseString(hokon));
await sys.Terminate();
var ser = sys.Serialization.FindSerializerFor(src);
var bin = ser.ToBinary(src);
return (T)ser.FromBinary(bin, typeof(T));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment