The following works:
This doesn't work:
using
NUnit.Framework;
using
Telerik.JustMock.AutoMock;
namespace
AutoMockBug
{
public
interface
IBar
{
void
DoNothing();
}
public
class
Baz
{
public
IBar Bar;
public
Baz(IBar bar)
{
Bar
= bar;
}
}
[TestFixture]
public
class
Class1
{
[Test]
public
void
test()
{
var container =
new
MockingContainer<Baz>();
container.Arrange<IBar>(x => x.DoNothing()).OccursOnce();
container.Instance.Bar.DoNothing();
container.Assert();
}
}
}
This doesn't work:
using
NUnit.Framework;
using
Telerik.JustMock.AutoMock;
namespace
AutoMockBug
{
public
interface
IFoo
{
IBar GetBar();
}
public
interface
IBar
{
void
DoNothing();
}
public
class
Baz
{
public
IFoo Foo;
public
Baz(IFoo foo)
{
Foo = foo;
}
}
[TestFixture]
public
class
Class1
{
[Test]
public
void
test()
{
var container =
new
MockingContainer<Baz>();
container.Arrange<IBar>(x => x.DoNothing()).OccursOnce();
container.Instance.Foo.GetBar().DoNothing();
container.Assert();
}
}
}