This should work so that you can wrap singletons with decorators.
[Fact]
public void Intercept_Singleton_Before_Lifestyle_Test()
{
var container = new DependencyInjectionContainer
{
c =>
{
c.Export<Calculator>().As<ICalculator>().Lifestyle.Singleton();
c.Export<Interceptor>().Lifestyle.Singleton();
c.Intercept<ICalculator, Interceptor>();
}
};
var calculator = container.Locate<ICalculator>();
Assert.NotNull(calculator);
var value = calculator.Add(2, 3);
Assert.Equal(5, value);
var interceptor = container.Locate<Interceptor>();
Assert.NotNull(interceptor);
Assert.NotNull(interceptor.Arguements);
Assert.Equal(2, interceptor.Arguements.Length);
Assert.Equal(2, interceptor.Arguements[0]);
Assert.Equal(3, interceptor.Arguements[1]);
}
This should work so that you can wrap singletons with decorators.
This was mentioned in issue #66