#25: remove non-generic register methods

pull/32/head
Simon Gockner 6 years ago
parent cb4ea88597
commit f852fedae3
  1. 41
      LightweightIocContainer/Interfaces/IIocContainer.cs
  2. 65
      LightweightIocContainer/IocContainer.cs
  3. 115
      LightweightIocContainer/LightweightIocContainer.xml
  4. 51
      LightweightIocContainer/Registrations/RegistrationFactory.cs
  5. 10
      Test.LightweightIocContainer/IocContainerTest.cs

@ -22,7 +22,7 @@ namespace LightweightIocContainer.Interfaces
IIocContainer Install(params IIocInstaller[] installers);
/// <summary>
/// Register an Interface with a Type that implements it/>
/// Register an Interface with a Type that implements it
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
@ -31,7 +31,7 @@ namespace LightweightIocContainer.Interfaces
IDefaultRegistration<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle = Lifestyle.Transient) where TImplementation : TInterface;
/// <summary>
/// Register a <see cref="Type"/> without an interface/>
/// Register a <see cref="Type"/> without an interface
/// </summary>
/// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
@ -39,7 +39,7 @@ namespace LightweightIocContainer.Interfaces
IDefaultRegistration<TImplementation> Register<TImplementation>(Lifestyle lifestyle = Lifestyle.Transient);
/// <summary>
/// Register an Interface with a Type that implements it as a multiton/>
/// Register an Interface with a Type that implements it as a multiton
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
@ -48,45 +48,12 @@ namespace LightweightIocContainer.Interfaces
IMultitonRegistration<TInterface> Register<TInterface, TImplementation, TScope>() where TImplementation : TInterface;
/// <summary>
/// Register an Interface with a Type that implements it/>
/// </summary>
/// <param name="tInterface">The Interface to register</param>
/// <param name="tImplementation">The Type that implements the interface</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
IRegistrationBase Register(Type tInterface, Type tImplementation, Lifestyle lifestyle = Lifestyle.Transient);
/// <summary>
/// Register a <see cref="Type"/> without an interface/>
/// </summary>
/// <param name="tImplementation">The <see cref="Type"/> to register</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
IRegistrationBase Register(Type tImplementation, Lifestyle lifestyle = Lifestyle.Transient);
/// <summary>
/// Register an Interface with a Type that implements it as a multiton/>
/// </summary>
/// <param name="tInterface">The Interface to register</param>
/// <param name="tImplementation">The Type that implements the interface</param>
/// <param name="tScope">The Type of the multiton scope</param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
IRegistrationBase Register(Type tInterface, Type tImplementation, Type tScope);
/// <summary>
/// Register an Interface as an abstract typed factory/>
/// Register an Interface as an abstract typed factory
/// </summary>
/// <typeparam name="TFactory">The abstract typed factory to register</typeparam>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
ITypedFactoryRegistration<TFactory> RegisterFactory<TFactory>();
/// <summary>
/// Register an Interface as an abstract typed factory/>
/// </summary>
/// <param name="tFactory">The abstract typed factory to register</param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
IRegistrationBase RegisterFactory(Type tFactory);
/// <summary>
/// Register an Interface with an <see cref="ResolveCallback{T}"/> as a callback that is called when <see cref="Resolve{T}()"/> is called
/// </summary>

@ -53,7 +53,7 @@ namespace LightweightIocContainer
}
/// <summary>
/// Register an Interface with a Type that implements it/>
/// Register an Interface with a Type that implements it
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
@ -68,7 +68,7 @@ namespace LightweightIocContainer
}
/// <summary>
/// Register a <see cref="Type"/> without an interface/>
/// Register a <see cref="Type"/> without an interface
/// </summary>
/// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
@ -82,7 +82,7 @@ namespace LightweightIocContainer
}
/// <summary>
/// Register an Interface with a Type that implements it as a multiton/>
/// Register an Interface with a Type that implements it as a multiton
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
@ -97,51 +97,7 @@ namespace LightweightIocContainer
}
/// <summary>
/// Register an Interface with a Type that implements it/>
/// </summary>
/// <param name="tInterface">The Interface to register</param>
/// <param name="tImplementation">The Type that implements the interface</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
public IRegistrationBase Register(Type tInterface, Type tImplementation, Lifestyle lifestyle = Lifestyle.Transient)
{
IRegistrationBase registration = _registrationFactory.Register(tInterface, tImplementation, lifestyle);
Register(registration);
return registration;
}
/// <summary>
/// Register a <see cref="Type"/> without an interface/>
/// </summary>
/// <param name="tImplementation">The <see cref="Type"/> to register</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
public IRegistrationBase Register(Type tImplementation, Lifestyle lifestyle = Lifestyle.Transient)
{
IRegistrationBase registration = _registrationFactory.Register(tImplementation, lifestyle);
Register(registration);
return registration;
}
/// <summary>
/// Register an Interface with a Type that implements it as a multiton/>
/// </summary>
/// <param name="tInterface">The Interface to register</param>
/// <param name="tImplementation">The Type that implements the interface</param>
/// <param name="tScope">The Type of the multiton scope</param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
public IRegistrationBase Register(Type tInterface, Type tImplementation, Type tScope)
{
IRegistrationBase registration = _registrationFactory.Register(tInterface, tImplementation, tScope);
Register(registration);
return registration;
}
/// <summary>
/// Register an Interface as an abstract typed factory/>
/// Register an Interface as an abstract typed factory
/// </summary>
/// <typeparam name="TFactory">The abstract typed factory to register</typeparam>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
@ -153,19 +109,6 @@ namespace LightweightIocContainer
return registration;
}
/// <summary>
/// Register an Interface as an abstract typed factory/>
/// </summary>
/// <param name="tFactory">The abstract typed factory to register</param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
public IRegistrationBase RegisterFactory(Type tFactory)
{
IRegistrationBase registration = _registrationFactory.RegisterFactory(tFactory);
Register(registration);
return registration;
}
/// <summary>
/// Register an Interface with an <see cref="ResolveCallback{T}"/> as a callback that is called when <see cref="Resolve{T}()"/> is called
/// </summary>

@ -219,7 +219,7 @@
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``2(LightweightIocContainer.Lifestyle)">
<summary>
Register an Interface with a Type that implements it/>
Register an Interface with a Type that implements it
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
@ -228,7 +228,7 @@
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``1(LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface/>
Register a <see cref="T:System.Type"/> without an interface
</summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
@ -236,53 +236,20 @@
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``3">
<summary>
Register an Interface with a Type that implements it as a multiton/>
Register an Interface with a Type that implements it as a multiton
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
<typeparam name="TScope">The Type of the multiton scope</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register(System.Type,System.Type,LightweightIocContainer.Lifestyle)">
<summary>
Register an Interface with a Type that implements it/>
</summary>
<param name="tInterface">The Interface to register</param>
<param name="tImplementation">The Type that implements the interface</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register(System.Type,LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface/>
</summary>
<param name="tImplementation">The <see cref="T:System.Type"/> to register</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register(System.Type,System.Type,System.Type)">
<summary>
Register an Interface with a Type that implements it as a multiton/>
</summary>
<param name="tInterface">The Interface to register</param>
<param name="tImplementation">The Type that implements the interface</param>
<param name="tScope">The Type of the multiton scope</param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterFactory``1">
<summary>
Register an Interface as an abstract typed factory/>
Register an Interface as an abstract typed factory
</summary>
<typeparam name="TFactory">The abstract typed factory to register</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterFactory(System.Type)">
<summary>
Register an Interface as an abstract typed factory/>
</summary>
<param name="tFactory">The abstract typed factory to register</param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})">
<summary>
Register an Interface with an <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called when <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> is called
@ -445,7 +412,7 @@
</member>
<member name="M:LightweightIocContainer.IocContainer.Register``2(LightweightIocContainer.Lifestyle)">
<summary>
Register an Interface with a Type that implements it/>
Register an Interface with a Type that implements it
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
@ -454,7 +421,7 @@
</member>
<member name="M:LightweightIocContainer.IocContainer.Register``1(LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface/>
Register a <see cref="T:System.Type"/> without an interface
</summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
@ -462,53 +429,20 @@
</member>
<member name="M:LightweightIocContainer.IocContainer.Register``3">
<summary>
Register an Interface with a Type that implements it as a multiton/>
Register an Interface with a Type that implements it as a multiton
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
<typeparam name="TScope">The Type of the multiton scope</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.Register(System.Type,System.Type,LightweightIocContainer.Lifestyle)">
<summary>
Register an Interface with a Type that implements it/>
</summary>
<param name="tInterface">The Interface to register</param>
<param name="tImplementation">The Type that implements the interface</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.Register(System.Type,LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface/>
</summary>
<param name="tImplementation">The <see cref="T:System.Type"/> to register</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.Register(System.Type,System.Type,System.Type)">
<summary>
Register an Interface with a Type that implements it as a multiton/>
</summary>
<param name="tInterface">The Interface to register</param>
<param name="tImplementation">The Type that implements the interface</param>
<param name="tScope">The Type of the multiton scope</param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.RegisterFactory``1">
<summary>
Register an Interface as an abstract typed factory/>
Register an Interface as an abstract typed factory
</summary>
<typeparam name="TFactory">The abstract typed factory to register</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.RegisterFactory(System.Type)">
<summary>
Register an Interface as an abstract typed factory/>
</summary>
<param name="tFactory">The abstract typed factory to register</param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})">
<summary>
Register an Interface with an <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called when <see cref="M:LightweightIocContainer.IocContainer.Resolve``1"/> is called
@ -735,32 +669,6 @@
<typeparam name="TScope">The Type of the multiton scope</typeparam>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1"/> with the given parameters</returns>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register(System.Type,System.Type,LightweightIocContainer.Lifestyle)">
<summary>
Register an Interface with a Type that implements it and create a <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/>
</summary>
<param name="tInterface">The Interface to register</param>
<param name="tImplementation">The Type that implements the interface</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/> with the given parameters</returns>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register(System.Type,LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface and create a <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/>
</summary>
<param name="tImplementation">The <see cref="T:System.Type"/> to register</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/> with the given parameters</returns>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register(System.Type,System.Type,System.Type)">
<summary>
Register an Interface with a Type that implements it as a multiton and create a <see cref="T:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1"/>
</summary>
<param name="tInterface">The Interface to register</param>
<param name="tImplementation">The Type that implements the interface</param>
<param name="tScope">The Type of the multiton scope</param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1"/> with the given parameters</returns>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.RegisterFactory``1">
<summary>
Register an Interface as an abstract typed factory and create a <see cref="T:LightweightIocContainer.Interfaces.Registrations.ITypedFactoryRegistration`1"/>
@ -768,13 +676,6 @@
<typeparam name="TFactory">The abstract typed factory to register</typeparam>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.ITypedFactoryRegistration`1"/> with the given parameters</returns>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.RegisterFactory(System.Type)">
<summary>
Register an Interface as an abstract typed factory and create a <see cref="T:LightweightIocContainer.Interfaces.Registrations.ITypedFactoryRegistration`1"/>
</summary>
<param name="tFactory">The abstract typed factory to register</param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.ITypedFactoryRegistration`1"/> with the given parameters</returns>
</member>
<member name="T:LightweightIocContainer.Registrations.TypedFactoryRegistration`1">
<summary>
The registration that is used to register an abstract typed factory

@ -60,46 +60,6 @@ namespace LightweightIocContainer.Registrations
return new MultitonRegistration<TInterface>(typeof(TInterface), typeof(TImplementation), typeof(TScope));
}
/// <summary>
/// Register an Interface with a Type that implements it and create a <see cref="IDefaultRegistration{TInterface}"/>
/// </summary>
/// <param name="tInterface">The Interface to register</param>
/// <param name="tImplementation">The Type that implements the interface</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface}"/> with the given parameters</returns>
public IRegistrationBase Register(Type tInterface, Type tImplementation, Lifestyle lifestyle)
{
Type defaultRegistrationType = typeof(DefaultRegistration<>).MakeGenericType(tInterface);
return (IRegistrationBase)Activator.CreateInstance(defaultRegistrationType, tInterface, tImplementation, lifestyle);
}
/// <summary>
/// Register a <see cref="Type"/> without an interface and create a <see cref="IDefaultRegistration{TInterface}"/>
/// </summary>
/// <param name="tImplementation">The <see cref="Type"/> to register</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface}"/> with the given parameters</returns>
public IRegistrationBase Register(Type tImplementation, Lifestyle lifestyle)
{
if (tImplementation.IsInterface)
throw new InvalidRegistrationException("Can't register an interface without its implementation type.");
return Register(tImplementation, tImplementation, lifestyle);
}
/// <summary>
/// Register an Interface with a Type that implements it as a multiton and create a <see cref="IMultitonRegistration{TInterface}"/>
/// </summary>
/// <param name="tInterface">The Interface to register</param>
/// <param name="tImplementation">The Type that implements the interface</param>
/// <param name="tScope">The Type of the multiton scope</param>
/// <returns>A new created <see cref="IMultitonRegistration{TInterface}"/> with the given parameters</returns>
public IRegistrationBase Register(Type tInterface, Type tImplementation, Type tScope)
{
Type multitonRegistrationType = typeof(MultitonRegistration<>).MakeGenericType(tInterface);
return (IRegistrationBase)Activator.CreateInstance(multitonRegistrationType, tInterface, tImplementation, tScope);
}
/// <summary>
/// Register an Interface as an abstract typed factory and create a <see cref="ITypedFactoryRegistration{TFactory}"/>
/// </summary>
@ -110,17 +70,6 @@ namespace LightweightIocContainer.Registrations
return new TypedFactoryRegistration<TFactory>(typeof(TFactory), _iocContainer);
}
/// <summary>
/// Register an Interface as an abstract typed factory and create a <see cref="ITypedFactoryRegistration{TFactory}"/>
/// </summary>
/// <param name="tFactory">The abstract typed factory to register</param>
/// <returns>A new created <see cref="ITypedFactoryRegistration{TFactory}"/> with the given parameters</returns>
public IRegistrationBase RegisterFactory(Type tFactory)
{
Type factoryRegistrationType = typeof(TypedFactoryRegistration<>).MakeGenericType(tFactory);
return (IRegistrationBase)Activator.CreateInstance(factoryRegistrationType, tFactory, _iocContainer);
}
public IUnitTestCallbackRegistration<TInterface> RegisterUnitTestCallback<TInterface>(ResolveCallback<TInterface> unitTestResolveCallback)
{
return new UnitTestCallbackRegistration<TInterface>(typeof(TInterface), unitTestResolveCallback);

@ -65,6 +65,7 @@ namespace Test.LightweightIocContainer
[UsedImplicitly]
private class TestByte : ITest
{
[UsedImplicitly]
private readonly byte _id;
public TestByte(byte id)
@ -127,25 +128,25 @@ namespace Test.LightweightIocContainer
[Test]
public void TestRegister()
{
Assert.DoesNotThrow(() => _iocContainer.Register(typeof(ITest), typeof(Test)));
Assert.DoesNotThrow(() => _iocContainer.Register<ITest, Test>());
}
[Test]
public void TestRegisterTypeWithoutInterface()
{
Assert.DoesNotThrow(() => _iocContainer.Register(typeof(Test)));
Assert.DoesNotThrow(() => _iocContainer.Register<Test>());
}
[Test]
public void TestRegisterMultiton()
{
Assert.DoesNotThrow(() => _iocContainer.Register(typeof(ITest), typeof(Test), typeof(MultitonScope)));
Assert.DoesNotThrow(() => _iocContainer.Register<ITest, Test, MultitonScope>());
}
[Test]
public void TestRegisterFactory()
{
Assert.DoesNotThrow(() => _iocContainer.RegisterFactory(typeof(ITestFactory)));
Assert.DoesNotThrow(() => _iocContainer.RegisterFactory<ITestFactory>());
}
[Test]
@ -160,7 +161,6 @@ namespace Test.LightweightIocContainer
public void TestRegisterInterfaceWithoutImplementation()
{
Assert.Throws<InvalidRegistrationException>(() => _iocContainer.Register<ITest>());
Assert.Throws<InvalidRegistrationException>(() => _iocContainer.Register(typeof(ITest)));
}
[Test]

Loading…
Cancel
Save