Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.25 KB

README.md

File metadata and controls

38 lines (30 loc) · 1.25 KB

Introduction

The purpose of this project is to allow that Autofixture to create your Akka.Net actors in your tests with Xunit2.

Getting Started

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
}

Build and Test

To build this project you will need Visual Studio 2017. If you already have it, clone this repo and have fun!