public void FakeFixture_DefaultSingletonFalse_ReturnsCorrectInstance() { var fixture = new FakeFixture(defaultSingleton: false); var instance1 = fixture.Fake <ISomeInterface>(x => A.CallTo(() => x.SomeIntMethod()).Returns(10)); var instance2 = fixture.Fake <ISomeInterface>(x => A.CallTo(() => x.SomeIntMethod()).Returns(15)); Assert.Equal(0, fixture.Locate <ISomeInterface>().SomeIntMethod()); Assert.Equal(10, instance1.SomeIntMethod()); Assert.Equal(15, instance2.SomeIntMethod()); Assert.Equal(0, fixture.Locate <ISomeInterface>().SomeIntMethod()); }
public void FakeFixture_LocateTypeWithInterface_ReturnsInstance() { var fixture = new FakeFixture(); var instance = fixture.Locate <ImportSomeInterface>(); Assert.NotNull(instance); Assert.Equal(0, instance.SomeValue); }
public void FakeFixture_FakeAndLocateTypeWithInterface_ReturnsInstance() { var fixture = new FakeFixture(); fixture.Fake <ISomeInterface>(f => A.CallTo(() => f.SomeIntMethod()).Returns(10)); var instance = fixture.Locate <ImportSomeInterface>(); Assert.NotNull(instance); Assert.Equal(10, instance.SomeValue); }