-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Given code like this:
public interface IFoo
{
string Bar { get; }
}
public class Foo
{
public virtual string Bar { get; }
}
public class Subject
{
public string DoSomethingWithInterface(IFoo foo)
{
return foo.Bar;
}
public string DoSomethingWithClass(Foo foo)
{
return foo.Bar;
}
}
public class TestInterface : ScenarioFor<Subject>
{
string _result;
void GivenAFooWithBar() => The<IFoo>().Bar.Returns("Bar");
void WhenDoingSomething() => _result = SUT.DoSomethingWithInterface(The<IFoo>());
void ThenTheResultIsBar() => _result.Should().Be(The<IFoo>().Bar);
}
public class TestClass : ScenarioFor<Subject>
{
string _result;
void GivenAFooWithBar() => The<Foo>().Bar.Returns("Bar");
void WhenDoingSomething() => _result = SUT.DoSomethingWithClass(The<Foo>());
void ThenTheResultIsBar() => _result.Should().Be(The<Foo>().Bar);
}The second test fails on the line GivenAFooWithBar(). It should work the same as with the interface.
Metadata
Metadata
Assignees
Labels
No labels