Open
Description
I want to be able to use a different class than the Test class when using fluent interface.
It helps isolate the different scenarios and make sure that one scenario cannot change the result of another scenario.
SO if I have a test class called "SharedState" and another class called "Tester" I want to be able to write the following:
[TestFixture]
public class SharedState
{
[Test]
public void Test1()
{
new Tester()
.Given(s => s.NOP())
.When(s => s.AddItemToList())
.Then(s => s.AssertMe())
.BDDfy();
}
[Test]
public void Test2()
{
new Tester()
.Given(s => s.NOP())
.When(s => s.AddItemToList())
.Then(s => s.AssertMe())
.BDDfy();
}
}
public class Tester
{
private readonly List _theList = new List();
public void AddItemToList()
{
_theList.Add(1);
}
public void NOP()
{
}
public void AssertMe()
{
Assert.AreEqual(1, _theList.Count);
}
}
The tests run perfectly but the scenario names are missing