The purpose of this project is to allow that Autofixture to create your Akka.Net actors in your tests with Xunit2.
You first need to install the Braspag.Autofixture.Xunit2.Akka package from Nuget.org:
PM> Braspag.Autofixture.Xunit2.Akka
After that, you need to add the ActorSpecimenBuilder to your AutoDataAttribute:
public class AutoActorDataAttribute : AutoDataAttribute
{
public AutoActorDataAttribute() : this(new Fixture())
{
}
public AutoActorDataAttribute(IFixture fixture)
{
Fixture.Behaviors.Add(new OmitOnRecursionBehavior());
}
}
And finally, in your tests, you should add your actor as parameter using the generic type TestActorRefWrapper where T must inhereit from ActorBase:
[Theory, AutoActorDataAttribute]
public void ProcessBatches_WhenBatchesExistsInDb_ShouldSendMessageToProcessTransactionCoordinator(TestActorRefWrapper<MyActorClass> sut)
{
// Your test
}
To build this project you will need Visual Studio 2017. If you already have it, clone this repo and have fun!