|
|
|
@ -44,6 +44,11 @@ namespace Test.LightweightIocContainer |
|
|
|
void ClearMultitonInstance(); |
|
|
|
void ClearMultitonInstance(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private interface IFoo |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class Test : ITest |
|
|
|
private class Test : ITest |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
@ -61,6 +66,11 @@ namespace Test.LightweightIocContainer |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TestConstructor(IFoo foo, string name) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[UsedImplicitly] |
|
|
|
[UsedImplicitly] |
|
|
|
@ -84,6 +94,12 @@ namespace Test.LightweightIocContainer |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[UsedImplicitly] |
|
|
|
|
|
|
|
private class Foo : IFoo |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class MultitonScope |
|
|
|
public class MultitonScope |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
@ -449,6 +465,17 @@ namespace Test.LightweightIocContainer |
|
|
|
Assert.AreEqual(callbackTest, test); |
|
|
|
Assert.AreEqual(callbackTest, test); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
|
|
|
public void TestResolveSingleTypeRegistrationWithFactoryMethod() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_iocContainer.Register<IFoo, Foo>(); |
|
|
|
|
|
|
|
_iocContainer.Register<ITest>().WithFactoryMethod(c => new TestConstructor(c.Resolve<IFoo>(), "someName")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ITest test = _iocContainer.Resolve<ITest>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(test); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public void TestIsTypeRegistered() |
|
|
|
public void TestIsTypeRegistered() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|