csf-dev / CSF.Screenplay

Implementation of the Screenplay pattern (aka Journey) in .NET
https://csf-dev.github.io/CSF.Screenplay/
MIT License
13 stars 1 forks source link

Add documentation about configuring well-known actors #121

Closed craigfowler closed 6 years ago

craigfowler commented 6 years ago

A quirk of the dependency injection, which may be leveraged, is that specifically-named parameters will resolve using a matching registration name.

For example:

[Test, Screenplay]
public void MyTest(Actor joe)
{
  // Implementation omitted
}

In this example, the resolver will first try to resolve the actor using the registration name "joe". If it finds no matching registration then it will use a nameless registration.

This can be leveraged in the setup logic to preconfigure the actor before passing it to the test logic.

A test should be constructed for this scenario to verify that it works like this.

craigfowler commented 6 years ago

The test should cover SpecFlow as well as NUnit.

craigfowler commented 6 years ago

Won't fix, this is not a good way of configuring actors.