public void InstancesAreNotEqual() { var firstInstance = new TypeMatchingConstructorArgument(typeof(Samurai), (context, target) => null); var secondInstance = new TypeMatchingConstructorArgument(typeof(Ninja), (context, target) => null); var result = firstInstance.Equals(secondInstance); result.Should().BeFalse(); }
/// <summary> /// Gets the constructor arguments that shall be passed with the instance request. Created constructor arguments are flagged as inherited /// and are of type TypeMatchingConstructorArgument /// </summary> /// <param name="methodInfo">The method info of the method that was called on the factory.</param> /// <param name="arguments">The arguments that were passed to the factory.</param> /// <returns>The constructor arguments that shall be passed with the instance request.</returns> protected override IConstructorArgument[] GetConstructorArguments(MethodInfo methodInfo, object[] arguments) { ParameterInfo[] parameters = methodInfo.GetParameters(); IConstructorArgument[] constructorArguments = new IConstructorArgument[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { int closure = i; constructorArguments[i] = new TypeMatchingConstructorArgument(parameters[i].ParameterType, (context, target) => arguments[closure], true); } return constructorArguments; }