I have the following code:
public interface IService { }
public class MyService : IService { }
and a test method
[Test]
public void T1()
{
IWindsorContainer container = new WindsorContainer();
container.Register(Component.For<IService>()
.ImplementedBy<MyService>());
var s1 = container.Resolve<IService>();
var s2 = container.Resolve<IService>();
Assert.AreNotSame(s1, s2);
}
What should I change for the test to pass?
Set the lifestyle to
Transient:The default lifestyle is
Singletonand that’s why you see the same instance.