#52: update visibility for registration properties

pull/57/head
Simon G 4 years ago
parent d83d94e393
commit 4ab55e8bfc
  1. 2
      LightweightIocContainer/Interfaces/Registrations/Fluent/IOnCreate.cs
  2. 13
      LightweightIocContainer/Interfaces/Registrations/Fluent/IWithFactory.cs
  3. 19
      LightweightIocContainer/Interfaces/Registrations/Fluent/IWithParameters.cs
  4. 2
      LightweightIocContainer/Interfaces/Registrations/IRegistrationBase.cs
  5. 14
      LightweightIocContainer/IocContainer.cs
  6. 36
      LightweightIocContainer/LightweightIocContainer.xml
  7. 3
      LightweightIocContainer/Registrations/RegistrationBase.cs
  8. 8
      LightweightIocContainer/Registrations/TypedRegistration.cs
  9. 2
      LightweightIocContainer/Validation/IocValidator.cs
  10. 5
      Test.LightweightIocContainer/RegistrationBaseTest.cs

@ -16,7 +16,7 @@ namespace LightweightIocContainer.Interfaces.Registrations.Fluent
/// This <see cref="Action"/> is invoked when an instance of this type is created. /// This <see cref="Action"/> is invoked when an instance of this type is created.
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="IOnCreate{TInterface, TImplementation}.OnCreate"/></para> /// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="IOnCreate{TInterface, TImplementation}.OnCreate"/></para>
/// </summary> /// </summary>
Action<object> OnCreateAction { get; } internal Action<object> OnCreateAction { get; }
} }
/// <summary> /// <summary>

@ -11,11 +11,6 @@ namespace LightweightIocContainer.Interfaces.Registrations.Fluent
/// </summary> /// </summary>
public interface IWithFactory public interface IWithFactory
{ {
/// <summary>
/// The Factory added with the <see cref="WithFactory{TFactory}"/> method
/// </summary>
ITypedFactory Factory { get; }
/// <summary> /// <summary>
/// Register an abstract typed factory for the <see cref="IRegistrationBase"/> /// Register an abstract typed factory for the <see cref="IRegistrationBase"/>
/// </summary> /// </summary>
@ -31,4 +26,12 @@ namespace LightweightIocContainer.Interfaces.Registrations.Fluent
/// <returns>The current instance of this <see cref="IRegistrationBase"/></returns> /// <returns>The current instance of this <see cref="IRegistrationBase"/></returns>
IRegistrationBase WithFactory<TFactoryInterface, TFactoryImplementation>() where TFactoryImplementation : TFactoryInterface; IRegistrationBase WithFactory<TFactoryInterface, TFactoryImplementation>() where TFactoryImplementation : TFactoryInterface;
} }
internal interface IWithFactoryInternal : IWithFactory
{
/// <summary>
/// The Factory added with the <see cref="IWithFactory.WithFactory{TFactory}"/> method
/// </summary>
ITypedFactory Factory { get; }
}
} }

@ -13,19 +13,13 @@ namespace LightweightIocContainer.Interfaces.Registrations.Fluent
/// </summary> /// </summary>
public interface IWithParameters public interface IWithParameters
{ {
/// <summary>
/// An <see cref="Array"/> of parameters that are used to <see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="WithParameters(object[])"/></para>
/// </summary>
object[] Parameters { get; }
/// <summary> /// <summary>
/// Pass parameters that will be used to<see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/> /// Pass parameters that will be used to<see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving</para> /// <para>Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving</para>
/// </summary> /// </summary>
/// <param name="parameters">The parameters</param> /// <param name="parameters">The parameters</param>
/// <returns>The current instance of this <see cref="IRegistrationBase"/></returns> /// <returns>The current instance of this <see cref="IRegistrationBase"/></returns>
/// <exception cref="InvalidRegistrationException"><see cref="Parameters"/> are already set or no parameters given</exception> /// <exception cref="InvalidRegistrationException"><see cref="IWithParametersInternal.Parameters"/> are already set or no parameters given</exception>
IRegistrationBase WithParameters(params object[] parameters); IRegistrationBase WithParameters(params object[] parameters);
/// <summary> /// <summary>
@ -34,7 +28,16 @@ namespace LightweightIocContainer.Interfaces.Registrations.Fluent
/// </summary> /// </summary>
/// <param name="parameters">The parameters with their position</param> /// <param name="parameters">The parameters with their position</param>
/// <returns>The current instance of this <see cref="IRegistrationBase"/></returns> /// <returns>The current instance of this <see cref="IRegistrationBase"/></returns>
/// <exception cref="InvalidRegistrationException"><see cref="Parameters"/> are already set or no parameters given</exception> /// <exception cref="InvalidRegistrationException"><see cref="IWithParametersInternal.Parameters"/> are already set or no parameters given</exception>
IRegistrationBase WithParameters(params (int index, object parameter)[] parameters); IRegistrationBase WithParameters(params (int index, object parameter)[] parameters);
} }
internal interface IWithParametersInternal : IWithParameters
{
/// <summary>
/// An <see cref="Array"/> of parameters that are used to <see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="IWithParameters.WithParameters(object[])"/></para>
/// </summary>
object[] Parameters { get; }
}
} }

@ -9,7 +9,7 @@ namespace LightweightIocContainer.Interfaces.Registrations
/// <summary> /// <summary>
/// The <see cref="IRegistrationBase"/> that is used to register an Interface and extends the <see cref="IRegistration"/> with fluent options /// The <see cref="IRegistrationBase"/> that is used to register an Interface and extends the <see cref="IRegistration"/> with fluent options
/// </summary> /// </summary>
public interface IRegistrationBase : IRegistration, IWithFactory, IWithParameters, ILifestyleProvider public interface IRegistrationBase : IRegistration, IWithFactory, IWithParameters
{ {
} }

@ -293,9 +293,9 @@ namespace LightweightIocContainer
T resolvedInstance = registration switch T resolvedInstance = registration switch
{ {
IRegistrationBase { Lifestyle: Lifestyle.Singleton } defaultRegistration => GetOrCreateSingletonInstance<T>(defaultRegistration, arguments, resolveStack), RegistrationBase { Lifestyle: Lifestyle.Singleton } defaultRegistration => GetOrCreateSingletonInstance<T>(defaultRegistration, arguments, resolveStack),
IRegistrationBase { Lifestyle: Lifestyle.Multiton } and IMultitonRegistration multitonRegistration => GetOrCreateMultitonInstance<T>(multitonRegistration, arguments, resolveStack), RegistrationBase { Lifestyle: Lifestyle.Multiton } and IMultitonRegistration multitonRegistration => GetOrCreateMultitonInstance<T>(multitonRegistration, arguments, resolveStack),
IRegistrationBase defaultRegistration => CreateInstance<T>(defaultRegistration, arguments, resolveStack), RegistrationBase defaultRegistration => CreateInstance<T>(defaultRegistration, arguments, resolveStack),
ITypedFactoryRegistration<T> typedFactoryRegistration => typedFactoryRegistration.Factory.Factory, ITypedFactoryRegistration<T> typedFactoryRegistration => typedFactoryRegistration.Factory.Factory,
_ => throw new UnknownRegistrationException($"There is no registration of type {registration.GetType().Name}.") _ => throw new UnknownRegistrationException($"There is no registration of type {registration.GetType().Name}.")
}; };
@ -386,7 +386,7 @@ namespace LightweightIocContainer
/// <returns>A newly created instance of the given <see cref="Type"/></returns> /// <returns>A newly created instance of the given <see cref="Type"/></returns>
private T CreateInstance<T>(IRegistration registration, object[] arguments, List<Type> resolveStack) private T CreateInstance<T>(IRegistration registration, object[] arguments, List<Type> resolveStack)
{ {
if (registration is IWithParameters { Parameters: { } } registrationWithParameters) if (registration is IWithParametersInternal { Parameters: { } } registrationWithParameters)
arguments = UpdateArgumentsWithRegistrationParameters(registrationWithParameters, arguments); arguments = UpdateArgumentsWithRegistrationParameters(registrationWithParameters, arguments);
T instance; T instance;
@ -427,12 +427,12 @@ namespace LightweightIocContainer
} }
/// <summary> /// <summary>
/// Update the given arguments with the <see cref="IWithParameters.Parameters"/> of the given <see cref="IRegistrationBase"/> /// Update the given arguments with the <see cref="IWithParametersInternal.Parameters"/> of the given <see cref="IRegistrationBase"/>
/// </summary> /// </summary>
/// <param name="registration">The <see cref="IRegistrationBase"/> of the given <see cref="Type"/></param> /// <param name="registration">The <see cref="IRegistrationBase"/> of the given <see cref="Type"/></param>
/// <param name="arguments">The constructor arguments</param> /// <param name="arguments">The constructor arguments</param>
/// <returns>The argument list updated with the <see cref="IWithParameters.Parameters"/></returns> /// <returns>The argument list updated with the <see cref="IWithParametersInternal.Parameters"/></returns>
private object[] UpdateArgumentsWithRegistrationParameters(IWithParameters registration, object[] arguments) private object[] UpdateArgumentsWithRegistrationParameters(IWithParametersInternal registration, object[] arguments)
{ {
if (arguments != null && arguments.Any()) //if more arguments were passed to resolve if (arguments != null && arguments.Any()) //if more arguments were passed to resolve
{ {

@ -574,11 +574,6 @@
Provides a <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactory.WithFactory``1"/> method to an <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> Provides a <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactory.WithFactory``1"/> method to an <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>
</summary> </summary>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactory.Factory">
<summary>
The Factory added with the <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactory.WithFactory``1"/> method
</summary>
</member>
<member name="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactory.WithFactory``1"> <member name="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactory.WithFactory``1">
<summary> <summary>
Register an abstract typed factory for the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> Register an abstract typed factory for the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>
@ -594,15 +589,14 @@
<typeparam name="TFactoryImplementation">The type of the implementation for the custom factory</typeparam> <typeparam name="TFactoryImplementation">The type of the implementation for the custom factory</typeparam>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns> <returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
</member> </member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters"> <member name="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactoryInternal.Factory">
<summary> <summary>
Provides a <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.Object[])"/> method to an <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> The Factory added with the <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithFactory.WithFactory``1"/> method
</summary> </summary>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.Parameters"> <member name="T:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters">
<summary> <summary>
An <see cref="T:System.Array"/> of parameters that are used to <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <see cref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/> Provides a <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.Object[])"/> method to an <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.Object[])"/></para>
</summary> </summary>
</member> </member>
<member name="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.Object[])"> <member name="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.Object[])">
@ -612,7 +606,7 @@
</summary> </summary>
<param name="parameters">The parameters</param> <param name="parameters">The parameters</param>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns> <returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<exception cref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.Parameters"/> are already set or no parameters given</exception> <exception cref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParametersInternal.Parameters"/> are already set or no parameters given</exception>
</member> </member>
<member name="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.ValueTuple{System.Int32,System.Object}[])"> <member name="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.ValueTuple{System.Int32,System.Object}[])">
<summary> <summary>
@ -621,7 +615,13 @@
</summary> </summary>
<param name="parameters">The parameters with their position</param> <param name="parameters">The parameters with their position</param>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns> <returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<exception cref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.Parameters"/> are already set or no parameters given</exception> <exception cref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParametersInternal.Parameters"/> are already set or no parameters given</exception>
</member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParametersInternal.Parameters">
<summary>
An <see cref="T:System.Array"/> of parameters that are used to <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <see cref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/>
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.WithParameters(System.Object[])"/></para>
</summary>
</member> </member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.ILifestyleProvider"> <member name="T:LightweightIocContainer.Interfaces.Registrations.ILifestyleProvider">
<summary> <summary>
@ -977,13 +977,13 @@
<param name="resolveStack">The current resolve stack</param> <param name="resolveStack">The current resolve stack</param>
<returns>A newly created instance of the given <see cref="T:System.Type"/></returns> <returns>A newly created instance of the given <see cref="T:System.Type"/></returns>
</member> </member>
<member name="M:LightweightIocContainer.IocContainer.UpdateArgumentsWithRegistrationParameters(LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters,System.Object[])"> <member name="M:LightweightIocContainer.IocContainer.UpdateArgumentsWithRegistrationParameters(LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParametersInternal,System.Object[])">
<summary> <summary>
Update the given arguments with the <see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.Parameters"/> of the given <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> Update the given arguments with the <see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParametersInternal.Parameters"/> of the given <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>
</summary> </summary>
<param name="registration">The <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> of the given <see cref="T:System.Type"/></param> <param name="registration">The <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> of the given <see cref="T:System.Type"/></param>
<param name="arguments">The constructor arguments</param> <param name="arguments">The constructor arguments</param>
<returns>The argument list updated with the <see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParameters.Parameters"/></returns> <returns>The argument list updated with the <see cref="P:LightweightIocContainer.Interfaces.Registrations.Fluent.IWithParametersInternal.Parameters"/></returns>
</member> </member>
<member name="M:LightweightIocContainer.IocContainer.ResolveConstructorArguments(System.Type,System.Object[],System.Collections.Generic.List{System.Type})"> <member name="M:LightweightIocContainer.IocContainer.ResolveConstructorArguments(System.Type,System.Object[],System.Collections.Generic.List{System.Type})">
<summary> <summary>
@ -1479,6 +1479,12 @@
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IOnCreate`2.OnCreate(System.Action{`1})"/></para> <para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IOnCreate`2.OnCreate(System.Action{`1})"/></para>
</summary> </summary>
</member> </member>
<member name="P:LightweightIocContainer.Registrations.TypedRegistration`2.LightweightIocContainer#Interfaces#Registrations#Fluent#IOnCreate#OnCreateAction">
<summary>
This <see cref="T:System.Action"/> is invoked when an instance of this type is created.
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Interfaces.Registrations.Fluent.IOnCreate`2.OnCreate(System.Action{`1})"/></para>
</summary>
</member>
<member name="M:LightweightIocContainer.Registrations.TypedRegistration`2.OnCreate(System.Action{`1})"> <member name="M:LightweightIocContainer.Registrations.TypedRegistration`2.OnCreate(System.Action{`1})">
<summary> <summary>
Pass an <see cref="T:System.Action`1"/> that will be invoked when an instance of this type is created Pass an <see cref="T:System.Action`1"/> that will be invoked when an instance of this type is created

@ -10,13 +10,14 @@ using LightweightIocContainer.Interfaces;
using LightweightIocContainer.Interfaces.Factories; using LightweightIocContainer.Interfaces.Factories;
using LightweightIocContainer.Interfaces.Installers; using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations; using LightweightIocContainer.Interfaces.Registrations;
using LightweightIocContainer.Interfaces.Registrations.Fluent;
namespace LightweightIocContainer.Registrations namespace LightweightIocContainer.Registrations
{ {
/// <summary> /// <summary>
/// The <see cref="RegistrationBase"/> that is used to register an Interface /// The <see cref="RegistrationBase"/> that is used to register an Interface
/// </summary> /// </summary>
public abstract class RegistrationBase : IRegistrationBase public abstract class RegistrationBase : IRegistrationBase, IWithFactoryInternal, IWithParametersInternal, ILifestyleProvider
{ {
private readonly IocContainer _container; private readonly IocContainer _container;

@ -35,7 +35,13 @@ namespace LightweightIocContainer.Registrations
/// This <see cref="Action"/> is invoked when an instance of this type is created. /// This <see cref="Action"/> is invoked when an instance of this type is created.
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="IOnCreate{TInterface,TImplementation}.OnCreate"/></para> /// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="IOnCreate{TInterface,TImplementation}.OnCreate"/></para>
/// </summary> /// </summary>
public Action<object> OnCreateAction { get; private set; } private Action<object> OnCreateAction { get; set; }
/// <summary>
/// This <see cref="Action"/> is invoked when an instance of this type is created.
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="IOnCreate{TInterface,TImplementation}.OnCreate"/></para>
/// </summary>
Action<object> IOnCreate.OnCreateAction => OnCreateAction;
/// <summary> /// <summary>
/// Pass an <see cref="Action{T}"/> that will be invoked when an instance of this type is created /// Pass an <see cref="Action{T}"/> that will be invoked when an instance of this type is created

@ -46,7 +46,7 @@ namespace LightweightIocContainer.Validation
foreach (IRegistration registration in _iocContainer.Registrations) foreach (IRegistration registration in _iocContainer.Registrations)
{ {
if (registration is IWithFactory { Factory: { } } withFactoryRegistration) if (registration is IWithFactoryInternal { Factory: { } } withFactoryRegistration)
{ {
(from createMethod in withFactoryRegistration.Factory.CreateMethods (from createMethod in withFactoryRegistration.Factory.CreateMethods
select createMethod.GetParameters().Select(p => p.ParameterType) select createMethod.GetParameters().Select(p => p.ParameterType)

@ -5,7 +5,6 @@
using JetBrains.Annotations; using JetBrains.Annotations;
using LightweightIocContainer; using LightweightIocContainer;
using LightweightIocContainer.Exceptions; using LightweightIocContainer.Exceptions;
using LightweightIocContainer.Interfaces.Registrations;
using LightweightIocContainer.Registrations; using LightweightIocContainer.Registrations;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -58,7 +57,7 @@ namespace Test.LightweightIocContainer
IBar bar = new Bar(); IBar bar = new Bar();
ITest test = new Test(); ITest test = new Test();
IRegistrationBase testRegistration = registrationFactory.Register<IFoo, Foo>(Lifestyle.Transient).WithParameters(bar, test); RegistrationBase testRegistration = (RegistrationBase) registrationFactory.Register<IFoo, Foo>(Lifestyle.Transient).WithParameters(bar, test);
Assert.AreEqual(bar, testRegistration.Parameters[0]); Assert.AreEqual(bar, testRegistration.Parameters[0]);
Assert.AreEqual(test, testRegistration.Parameters[1]); Assert.AreEqual(test, testRegistration.Parameters[1]);
@ -72,7 +71,7 @@ namespace Test.LightweightIocContainer
IBar bar = new Bar(); IBar bar = new Bar();
ITest test = new Test(); ITest test = new Test();
IRegistrationBase testRegistration = registrationFactory.Register<IFoo, Foo>(Lifestyle.Transient).WithParameters((0, bar), (3, test), (2, "SomeString")); RegistrationBase testRegistration = (RegistrationBase) registrationFactory.Register<IFoo, Foo>(Lifestyle.Transient).WithParameters((0, bar), (3, test), (2, "SomeString"));
Assert.AreEqual(bar, testRegistration.Parameters[0]); Assert.AreEqual(bar, testRegistration.Parameters[0]);
Assert.IsInstanceOf<InternalResolvePlaceholder>(testRegistration.Parameters[1]); Assert.IsInstanceOf<InternalResolvePlaceholder>(testRegistration.Parameters[1]);

Loading…
Cancel
Save