You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Test]
public void Create_ReturnsNewInstanceEachTime()
{
var a = _moq.Create<ClassWithFuncInCtor>();
var b = _moq.Create<ClassWithFuncInCtor>();
a.Should().NotBeSameAs(b);
}
[Test]
public void Create_FuncParameter_ReturnsSameInstanceEachTime()
{
var subject = _moq.Create<ClassWithFuncInCtor>();
var a = subject.FuncOfIDependencyA();
var b = subject.FuncOfIDependencyA();
a.Should().BeSameAs(b);
}
[Test]
public void Factory_For_Constructor_Func()
{
_moq.Factory<IDepencyA>(ctx => _moq.Create<IDepencyA>());
var subject = _moq.Create<ClassWithFuncInCtor>();
var a = subject.FuncOfIDependencyA();
var b = subject.FuncOfIDependencyA();
a.Should().NotBeSameAs(b, "we registered a factory for IDependencyA");
}
[Test]
public void Factory_Extensions()
{
// Same as _moq.Factory<T>(ctx => _moq.Create<T>())
_moq.Factory<IDepencyA>();
var subject = _moq.Create<ClassWithFuncInCtor>();
var a = subject.FuncOfIDependencyA();
var b = subject.FuncOfIDependencyA();
a.Should().NotBeSameAs(b, "we registered a factory for IDependencyA");
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: