Skip to content

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

License

Notifications You must be signed in to change notification settings

BraspagDevelopers/autofixture-xunit2-akka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages