diff --git a/src/Dependency/Injection/Abstracts/ParameterBase.cs b/src/Dependency/Injection/Abstracts/ParameterBase.cs index 481f11f..e601397 100644 --- a/src/Dependency/Injection/Abstracts/ParameterBase.cs +++ b/src/Dependency/Injection/Abstracts/ParameterBase.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.Reflection; namespace Unity.Injection @@ -8,7 +7,6 @@ namespace Unity.Injection /// A base class for implementing classes /// that deal in explicit types. /// - [DebuggerDisplay("Parameter: {ParameterType?.Name ?? \"Any Type\"}")] public abstract class ParameterBase : ParameterValue { #region Fields diff --git a/src/Dependency/Injection/Parameters/GenericParameter.cs b/src/Dependency/Injection/Parameters/GenericParameter.cs index e095706..3e30dbf 100644 --- a/src/Dependency/Injection/Parameters/GenericParameter.cs +++ b/src/Dependency/Injection/Parameters/GenericParameter.cs @@ -1,9 +1,12 @@ -namespace Unity.Injection +using System.Diagnostics; + +namespace Unity.Injection { /// /// A that lets you specify that /// an instance of a generic type parameter should be resolved. /// + [DebuggerDisplay("GenericParameter: Type={ParameterTypeName}")] public class GenericParameter : GenericBase { #region Constructors @@ -28,5 +31,15 @@ { } #endregion + + + #region Overrides + + public override string ToString() + { + return $"GenericParameter: Type={ParameterTypeName}"; + } + + #endregion } } diff --git a/src/Dependency/Injection/Parameters/GenericResolvedArrayParameter.cs b/src/Dependency/Injection/Parameters/GenericResolvedArrayParameter.cs index 65e36c4..431eaef 100644 --- a/src/Dependency/Injection/Parameters/GenericResolvedArrayParameter.cs +++ b/src/Dependency/Injection/Parameters/GenericResolvedArrayParameter.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Reflection; using Unity.Resolution; @@ -10,6 +11,7 @@ namespace Unity.Injection /// an array containing the registered instances of a generic type parameter /// should be resolved. /// + [DebuggerDisplay("GenericResolvedArrayParameter: Type={ParameterTypeName}")] public class GenericResolvedArrayParameter : GenericBase { #region Fields @@ -88,6 +90,11 @@ namespace Unity.Injection return (ref TContext context) => resolverMethod.Invoke(ref context, values); } + public override string ToString() + { + return $"GenericResolvedArrayParameter: Type={ParameterTypeName}"; + } + #endregion diff --git a/src/Dependency/Injection/Parameters/InjectionParameter.cs b/src/Dependency/Injection/Parameters/InjectionParameter.cs index 9be1036..6a2ae57 100644 --- a/src/Dependency/Injection/Parameters/InjectionParameter.cs +++ b/src/Dependency/Injection/Parameters/InjectionParameter.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using Unity.Resolution; namespace Unity.Injection @@ -8,6 +9,7 @@ namespace Unity.Injection /// the required /// when the container is configured. /// + [DebuggerDisplay("InjectionParameter: Type={ParameterType.Name ?? \"Any\"} Value={_value ?? \"null\"}")] public class InjectionParameter : ParameterBase, IResolve { #region Fields @@ -55,6 +57,16 @@ namespace Unity.Injection } #endregion + + + #region Overrides + + public override string ToString() + { + return $"InjectionParameter: Type={ParameterType.Name} Value={_value ?? "null"}"; + } + + #endregion } /// diff --git a/src/Dependency/Injection/Parameters/OptionalParameter.cs b/src/Dependency/Injection/Parameters/OptionalParameter.cs index 7a3eb5a..95186c7 100644 --- a/src/Dependency/Injection/Parameters/OptionalParameter.cs +++ b/src/Dependency/Injection/Parameters/OptionalParameter.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Reflection; using Unity.Exceptions; using Unity.Resolution; @@ -10,6 +11,7 @@ namespace Unity.Injection /// to configure a /// parameter or property as an optional dependency. /// + [DebuggerDisplay("OptionalParameter: Type={ParameterType?.Name ?? \"Any\"} Name={_name ?? \"null\"}")] public class OptionalParameter : ParameterBase, IResolverFactory, IResolverFactory @@ -126,6 +128,16 @@ namespace Unity.Injection } #endregion + + + #region Overrides + + public override string ToString() + { + return $"OptionalParameter: Type={ParameterType?.Name ?? "Any"} Name={_name ?? "null"}"; + } + + #endregion } /// diff --git a/src/Dependency/Injection/Parameters/ResolvedArrayParameter.cs b/src/Dependency/Injection/Parameters/ResolvedArrayParameter.cs index 6da8dab..9ee4ad3 100644 --- a/src/Dependency/Injection/Parameters/ResolvedArrayParameter.cs +++ b/src/Dependency/Injection/Parameters/ResolvedArrayParameter.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Reflection; using Unity.Resolution; @@ -10,6 +11,7 @@ namespace Unity.Injection /// resolver object that resolves all the named instances or the /// type registered in a container. /// + [DebuggerDisplay("ResolvedArrayParameter: Type={ParameterType.Name}")] public class ResolvedArrayParameter : ParameterBase, IResolverFactory, IResolverFactory @@ -136,6 +138,16 @@ namespace Unity.Injection #endregion + #region Overrides + + public override string ToString() + { + return $"ResolvedArrayParameter: Type={ParameterType.Name}"; + } + + #endregion + + #region Implementation private static object DoResolve(ref TContext context, object[] values) diff --git a/src/Dependency/Injection/Parameters/ResolvedParameter.cs b/src/Dependency/Injection/Parameters/ResolvedParameter.cs index 12e8e2a..38fc93f 100644 --- a/src/Dependency/Injection/Parameters/ResolvedParameter.cs +++ b/src/Dependency/Injection/Parameters/ResolvedParameter.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Reflection; using Unity.Resolution; @@ -9,6 +10,7 @@ namespace Unity.Injection /// resolver object that resolves the parameter via the /// container. /// + [DebuggerDisplay("ResolvedParameter: Type={ParameterType?.Name ?? \"Any\"} Name={_name ?? \"null\"}")] public class ResolvedParameter : ParameterBase, IResolverFactory, IResolverFactory @@ -105,6 +107,16 @@ namespace Unity.Injection } #endregion + + + #region Overrides + + public override string ToString() + { + return $"ResolvedParameter: Type={ParameterType?.Name ?? "Any"} Name={_name ?? "null"}"; + } + + #endregion } /// diff --git a/tests/Dependency/Injection/Parameters/ParameterBaseData.cs b/tests/Dependency/Injection/Parameters/ParameterBaseData.cs new file mode 100644 index 0000000..82283ef --- /dev/null +++ b/tests/Dependency/Injection/Parameters/ParameterBaseData.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Unity.Injection; + +namespace Injection.Parameters +{ + public class ParameterBaseData + { + #region Test Data + + private static ParameterInfo ParamInfo = + typeof(ParameterValueTests).GetMethod(nameof(GenericBaseTestMethod)) + .GetParameters() + .First(); + + private static ParameterInfo ArrayInfo = + typeof(ParameterValueTests).GetMethod(nameof(GenericBaseTestMethod)) + .GetParameters() + .Last(); + + private static ParameterInfo AddInfo = + typeof(List<>).GetMethod("Add") + .GetParameters() + .First(); + + private static ParameterInfo AddStringInfo = + typeof(List).GetMethod("Add") + .GetParameters() + .First(); + + public void GenericBaseTestMethod(TName value, TArray[] array) => throw new NotImplementedException(); + + #endregion + + public static IEnumerable GetEqualsAnyTypeData() + { + yield return new object[] { new OptionalParameter(), }; + yield return new object[] { new OptionalParameter(string.Empty) }; + + yield return new object[] { new ResolvedParameter() }; + yield return new object[] { new ResolvedParameter(string.Empty) }; + } + + public static IEnumerable GetEqualsValueTypeData() + { + yield return new object[] { new InjectionParameter(0) }; + yield return new object[] { new InjectionParameter(typeof(int), 0) }; + yield return new object[] { new InjectionParameter(0) }; + + yield return new object[] { new OptionalParameter(typeof(int)) }; + yield return new object[] { new OptionalParameter() }; + yield return new object[] { new OptionalParameter(typeof(int), string.Empty) }; + yield return new object[] { new OptionalParameter(string.Empty) }; + + yield return new object[] { new ResolvedParameter(typeof(int)) }; + yield return new object[] { new ResolvedParameter() }; + yield return new object[] { new ResolvedParameter(typeof(int), string.Empty) }; + yield return new object[] { new ResolvedParameter(string.Empty) }; + } + + public static IEnumerable GetEqualsArrayTypeData() + { + yield return new object[] { new OptionalParameter(typeof(string[])) }; + yield return new object[] { new OptionalParameter() }; + yield return new object[] { new OptionalParameter(typeof(string[]), string.Empty) }; + yield return new object[] { new OptionalParameter(string.Empty) }; + + yield return new object[] { new ResolvedParameter(typeof(string[])) }; + yield return new object[] { new ResolvedParameter() }; + yield return new object[] { new ResolvedParameter(typeof(string[]), string.Empty) }; + yield return new object[] { new ResolvedParameter(string.Empty) }; + + yield return new object[] { new ResolvedArrayParameter(typeof(string)) }; + yield return new object[] { new ResolvedArrayParameter() }; + yield return new object[] { new ResolvedArrayParameter(typeof(string), "string") }; + yield return new object[] { new ResolvedArrayParameter(typeof(string), typeof(string), "string") }; + + yield return new object[] { new InjectionParameter(new string[0]) }; + yield return new object[] { new InjectionParameter(typeof(string[]), new string[0]) }; + yield return new object[] { new InjectionParameter(new string[0]) }; + } + + public static IEnumerable GetEqualsGenericTypeData() + { + yield return new object[] { new InjectionParameter(typeof(List<>), 0) }; + + yield return new object[] { new OptionalParameter(typeof(List<>)) }; + yield return new object[] { new OptionalParameter(typeof(List<>), string.Empty) }; + + yield return new object[] { new ResolvedParameter(typeof(List<>)) }; + yield return new object[] { new ResolvedParameter(typeof(List<>), string.Empty) }; + } + + + public static IEnumerable GetEqualsGenericArrayTypeData() + { + yield return new object[] { new InjectionParameter(typeof(List<>), 0) }; + + yield return new object[] { new OptionalParameter(typeof(List<>)) }; + yield return new object[] { new OptionalParameter(typeof(List<>), string.Empty) }; + + yield return new object[] { new ResolvedParameter(typeof(List<>)) }; + yield return new object[] { new ResolvedParameter(typeof(List<>), string.Empty) }; + + yield return new object[] { new ResolvedArrayParameter(typeof(List<>)) }; + yield return new object[] { new ResolvedArrayParameter(typeof(List<>), 0) }; + yield return new object[] { new ResolvedArrayParameter(typeof(List<>), typeof(int), 0) }; + } + + + + public static IEnumerable GetEqualsBaseTypeData() + { + yield return new object[] { new InjectionParameter(0) }; + yield return new object[] { new InjectionParameter(typeof(int), 0) }; + yield return new object[] { new InjectionParameter(new string[0]) }; + + yield return new object[] { new OptionalParameter(), }; + yield return new object[] { new OptionalParameter(typeof(int)) }; + yield return new object[] { new OptionalParameter() }; + yield return new object[] { new OptionalParameter(string.Empty) }; + yield return new object[] { new OptionalParameter(typeof(int), string.Empty) }; + yield return new object[] { new OptionalParameter(string.Empty) }; + + + yield return new object[] { new ResolvedParameter() }; + yield return new object[] { new ResolvedParameter(typeof(int)) }; + yield return new object[] { new ResolvedParameter() }; + yield return new object[] { new ResolvedParameter(string.Empty) }; + yield return new object[] { new ResolvedParameter(typeof(int), string.Empty) }; + yield return new object[] { new ResolvedParameter(string.Empty) }; + + + yield return new object[] { new ResolvedArrayParameter() }; + yield return new object[] { new ResolvedArrayParameter(typeof(int)) }; + yield return new object[] { new ResolvedArrayParameter(typeof(int), 0) }; + yield return new object[] { new ResolvedArrayParameter(typeof(int), typeof(int), 0) }; + } + + + + + + + + + + + } +} diff --git a/tests/Dependency/Injection/Parameters/ParameterBaseTests.cs b/tests/Dependency/Injection/Parameters/ParameterBaseTests.cs index afdcebd..fbbb152 100644 --- a/tests/Dependency/Injection/Parameters/ParameterBaseTests.cs +++ b/tests/Dependency/Injection/Parameters/ParameterBaseTests.cs @@ -1,14 +1,12 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; -using System.Linq; -using System.Reflection; using Unity.Injection; namespace Injection.Parameters { [TestClass] - public abstract class ParameterBaseTests + public class ParameterBaseTests { [TestMethod] public virtual void ParameterTypeTest() @@ -18,9 +16,51 @@ namespace Injection.Parameters #region IEquatable - [TestMethod] - public virtual void EqualsTest() + + [DataTestMethod] + [DynamicData(nameof(ParameterBaseData.GetEqualsAnyTypeData), typeof(ParameterBaseData), DynamicDataSourceType.Method)] + public virtual void EqualsAnyTypeTest(ParameterValue parameter) { + // Validate + Assert.IsTrue(parameter.Equals(typeof(int))); + Assert.IsTrue(parameter.Equals(typeof(object))); + Assert.IsTrue(parameter.Equals(typeof(string))); + Assert.IsTrue(parameter.Equals(typeof(List<>))); + Assert.IsTrue(parameter.Equals(typeof(List))); + Assert.IsTrue(parameter.Equals(typeof(string[]))); + Assert.IsTrue(parameter.Equals(typeof(object[]))); + Assert.IsTrue(parameter.Equals(typeof(int[]))); + } + + [DataTestMethod] + [DynamicData(nameof(ParameterBaseData.GetEqualsValueTypeData), typeof(ParameterBaseData), DynamicDataSourceType.Method)] + public virtual void EqualsValueTypeTest(ParameterValue parameter) + { + // Validate + Assert.IsTrue(parameter.Equals(typeof(int))); + Assert.IsTrue(parameter.Equals(typeof(object))); + Assert.IsFalse(parameter.Equals(typeof(string))); + } + + [DataTestMethod] + [DynamicData(nameof(ParameterBaseData.GetEqualsArrayTypeData), typeof(ParameterBaseData), DynamicDataSourceType.Method)] + public virtual void EqualsArrayTypeTest(ParameterValue parameter) + { + // Validate + Assert.IsTrue(parameter.Equals(typeof(string[]))); + Assert.IsTrue(parameter.Equals(typeof(object[]))); + Assert.IsFalse(parameter.Equals(typeof(int))); + Assert.IsFalse(parameter.Equals(typeof(int[]))); + } + + [DataTestMethod] + [DynamicData(nameof(ParameterBaseData.GetEqualsGenericTypeData), typeof(ParameterBaseData), DynamicDataSourceType.Method)] + public virtual void EqualsGenericTypeTest(ParameterValue parameter) + { + // Validate + Assert.IsTrue(parameter.Equals(typeof(List<>))); + Assert.IsFalse(parameter.Equals(typeof(IEnumerable<>))); + Assert.IsFalse(parameter.Equals(typeof(List))); } #endregion diff --git a/tests/Dependency/Injection/Parameters/ParameterValidationTests.cs b/tests/Dependency/Injection/Parameters/ParameterValidationTests.cs new file mode 100644 index 0000000..6d22799 --- /dev/null +++ b/tests/Dependency/Injection/Parameters/ParameterValidationTests.cs @@ -0,0 +1,34 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using Unity.Injection; + +namespace Injection.Parameters +{ + [TestClass] + public class ParameterValidationTests + { + [TestMethod] + [ExpectedException(typeof(ArgumentNullException))] + public void InjectionParameterCtorTest() + { + new InjectionParameter(null); + } + + + // Issue https://github.com/unitycontainer/abstractions/issues/146 + [Ignore] + [TestMethod] + public void ResolvedArrayParameterCtorTest() + { + new ResolvedArrayParameter(null, typeof(string)); + } + + [Ignore] + [TestMethod] + [ExpectedException(typeof(ArgumentNullException))] + public void ResolvedArrayParameterElementTest() + { + new ResolvedArrayParameter(typeof(string), null); + } + } +} diff --git a/tests/Dependency/Injection/Parameters/ParameterValueTests.cs b/tests/Dependency/Injection/Parameters/ParameterValueTests.cs index 17fd4d2..0bea16a 100644 --- a/tests/Dependency/Injection/Parameters/ParameterValueTests.cs +++ b/tests/Dependency/Injection/Parameters/ParameterValueTests.cs @@ -36,6 +36,17 @@ namespace Injection.Parameters #endregion + + [DataTestMethod] + [DynamicData(nameof(GetToStringData), DynamicDataSourceType.Method)] + public void ToStringTest(ParameterValue parameter) + { + var name = parameter.GetType().Name; + + Assert.IsTrue(parameter.ToString().StartsWith(name)); + } + + [Ignore] [DataTestMethod] [DynamicData(nameof(GetEqualsData), DynamicDataSourceType.Method)] public virtual void EqualsTest(ParameterValue parameter, Type type, bool result) @@ -44,84 +55,94 @@ namespace Injection.Parameters Assert.AreEqual(result, parameter.Equals(type)); } - public class GetType - { + #region Test Data + public static IEnumerable GetToStringData() + { + yield return new object[] { new InjectionParameter(string.Empty) }; + yield return new object[] { new InjectionParameter(typeof(string), null) }; + yield return new object[] { new OptionalParameter() }; + yield return new object[] { new ResolvedParameter() }; + yield return new object[] { new ResolvedArrayParameter(typeof(string)) }; + yield return new object[] { new GenericParameter("T[]") }; + yield return new object[] { new GenericResolvedArrayParameter("T[]") }; } public static IEnumerable GetEqualsData() { - yield return new object[] { new InjectionParameter(typeof(List), string.Empty), typeof(List<>), false }; - yield return new object[] { new InjectionParameter(typeof(List), string.Empty), typeof(List), true }; - yield return new object[] { new InjectionParameter(typeof(List<>), string.Empty), typeof(List), false }; - yield return new object[] { new InjectionParameter(typeof(List<>), string.Empty), typeof(List<>), true }; - yield return new object[] { new InjectionParameter(AddInfo.ParameterType, string.Empty), AddInfo.ParameterType, true }; - yield return new object[] { new InjectionParameter(AddInfo.ParameterType, string.Empty), AddStringInfo.ParameterType, false }; - yield return new object[] { new InjectionParameter(string.Empty), typeof(string), true }; - yield return new object[] { new InjectionParameter(typeof(string), string.Empty), typeof(string), true }; - yield return new object[] { new InjectionParameter(string.Empty), ParamInfo.ParameterType, false }; - yield return new object[] { new InjectionParameter(typeof(string), string.Empty), ParamInfo.ParameterType, false }; - yield return new object[] { new InjectionParameter(ParamInfo.ParameterType, string.Empty), ParamInfo.ParameterType, true }; + yield return new object[] { new InjectionParameter(typeof(List), string.Empty), typeof(List<>), false }; + yield return new object[] { new InjectionParameter(typeof(List), string.Empty), typeof(List), true }; + yield return new object[] { new InjectionParameter(typeof(List<>), string.Empty), typeof(List), false }; + yield return new object[] { new InjectionParameter(typeof(List<>), string.Empty), typeof(List<>), true }; + yield return new object[] { new InjectionParameter(AddInfo.ParameterType, string.Empty), AddInfo.ParameterType, true }; + yield return new object[] { new InjectionParameter(AddInfo.ParameterType, string.Empty), AddStringInfo.ParameterType, false }; + yield return new object[] { new InjectionParameter(string.Empty), typeof(string), true }; + yield return new object[] { new InjectionParameter(typeof(string), string.Empty), typeof(string), true }; + yield return new object[] { new InjectionParameter(string.Empty), ParamInfo.ParameterType, false }; + yield return new object[] { new InjectionParameter(typeof(string), string.Empty), ParamInfo.ParameterType, false }; + yield return new object[] { new InjectionParameter(ParamInfo.ParameterType, string.Empty), ParamInfo.ParameterType, true }; - yield return new object[] { new OptionalParameter(), typeof(string), true }; - yield return new object[] { new OptionalParameter(), typeof(object), true }; - yield return new object[] { new OptionalParameter(), typeof(double), true }; - yield return new object[] { new OptionalParameter(typeof(string)), typeof(string), true }; - yield return new object[] { new OptionalParameter(typeof(string)), typeof(object), true }; - yield return new object[] { new OptionalParameter(typeof(string)), typeof(double), false }; - yield return new object[] { new OptionalParameter(string.Empty), typeof(string), true }; - yield return new object[] { new OptionalParameter(string.Empty), typeof(object), true }; - yield return new object[] { new OptionalParameter(string.Empty), typeof(double), true }; - yield return new object[] { new OptionalParameter(typeof(string), string.Empty), typeof(string), true }; - yield return new object[] { new OptionalParameter(typeof(string), string.Empty), typeof(object), true }; - yield return new object[] { new OptionalParameter(typeof(string), string.Empty), typeof(double), false }; - - - yield return new object[] { new ResolvedParameter(), typeof(string), true }; - yield return new object[] { new ResolvedParameter(), typeof(object), true }; - yield return new object[] { new ResolvedParameter(), typeof(double), true }; - yield return new object[] { new ResolvedParameter(typeof(string)), typeof(string), true }; - yield return new object[] { new ResolvedParameter(typeof(string)), typeof(object), true }; - yield return new object[] { new ResolvedParameter(typeof(string)), typeof(double), false }; - yield return new object[] { new ResolvedParameter(string.Empty), typeof(string), true }; - yield return new object[] { new ResolvedParameter(string.Empty), typeof(double), true }; - yield return new object[] { new ResolvedParameter(typeof(string), string.Empty), typeof(string), true }; - yield return new object[] { new ResolvedParameter(typeof(string), string.Empty), typeof(object), true }; - yield return new object[] { new ResolvedParameter(typeof(string), string.Empty), typeof(double), false }; + yield return new object[] { new OptionalParameter(), typeof(string), true }; + yield return new object[] { new OptionalParameter(), typeof(object), true }; + yield return new object[] { new OptionalParameter(), typeof(double), true }; + yield return new object[] { new OptionalParameter(typeof(string)), typeof(string), true }; + yield return new object[] { new OptionalParameter(typeof(string)), typeof(object), true }; + yield return new object[] { new OptionalParameter(typeof(string)), typeof(double), false }; + yield return new object[] { new OptionalParameter(string.Empty), typeof(string), true }; + yield return new object[] { new OptionalParameter(string.Empty), typeof(object), true }; + yield return new object[] { new OptionalParameter(string.Empty), typeof(double), true }; + yield return new object[] { new OptionalParameter(typeof(string), string.Empty), typeof(string), true }; + yield return new object[] { new OptionalParameter(typeof(string), string.Empty), typeof(object), true }; + yield return new object[] { new OptionalParameter(typeof(string), string.Empty), typeof(double), false }; - yield return new object[] { new ResolvedArrayParameter(typeof(string)), typeof(string[]), true }; - yield return new object[] { new ResolvedArrayParameter(typeof(string)), typeof(object[]), true }; - yield return new object[] { new ResolvedArrayParameter(typeof(string)), typeof(double[]), false }; - yield return new object[] { new ResolvedArrayParameter(typeof(string), string.Empty), typeof(string[]), true }; - yield return new object[] { new ResolvedArrayParameter(typeof(string), string.Empty), typeof(object[]), true }; - yield return new object[] { new ResolvedArrayParameter(typeof(string), string.Empty), typeof(double[]), false }; - yield return new object[] { new ResolvedArrayParameter(typeof(string), typeof(string), string.Empty), typeof(string[]), true }; - yield return new object[] { new ResolvedArrayParameter(typeof(string), typeof(string), string.Empty), typeof(object[]), true }; + yield return new object[] { new ResolvedParameter(), typeof(string), true }; + yield return new object[] { new ResolvedParameter(), typeof(object), true }; + yield return new object[] { new ResolvedParameter(), typeof(double), true }; + yield return new object[] { new ResolvedParameter(typeof(string)), typeof(string), true }; + yield return new object[] { new ResolvedParameter(typeof(string)), typeof(object), true }; + yield return new object[] { new ResolvedParameter(typeof(string)), typeof(double), false }; + yield return new object[] { new ResolvedParameter(string.Empty), typeof(string), true }; + yield return new object[] { new ResolvedParameter(string.Empty), typeof(double), true }; + yield return new object[] { new ResolvedParameter(typeof(string), string.Empty), typeof(string), true }; + yield return new object[] { new ResolvedParameter(typeof(string), string.Empty), typeof(object), true }; + yield return new object[] { new ResolvedParameter(typeof(string), string.Empty), typeof(double), false }; + + + yield return new object[] { new ResolvedArrayParameter(typeof(string)), typeof(string[]), true }; + yield return new object[] { new ResolvedArrayParameter(typeof(string)), typeof(object[]), true }; + yield return new object[] { new ResolvedArrayParameter(typeof(string)), typeof(double[]), false }; + yield return new object[] { new ResolvedArrayParameter(typeof(string), string.Empty), typeof(string[]), true }; + yield return new object[] { new ResolvedArrayParameter(typeof(string), string.Empty), typeof(object[]), true }; + yield return new object[] { new ResolvedArrayParameter(typeof(string), string.Empty), typeof(double[]), false }; + yield return new object[] { new ResolvedArrayParameter(typeof(string), typeof(string), string.Empty), typeof(string[]), true }; + yield return new object[] { new ResolvedArrayParameter(typeof(string), typeof(string), string.Empty), typeof(object[]), true }; yield return new object[] { new ResolvedArrayParameter(typeof(string), typeof(string), string.Empty), typeof(double[]), false }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), ParamInfo.ParameterType, true }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), ParamInfo.ParameterType, true }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), ParamInfo.ParameterType, true }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), ParamInfo.ParameterType, true }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), ArrayInfo.ParameterType, false }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), ArrayInfo.ParameterType, false }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), typeof(string), false }; - yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), typeof(string), false }; - yield return new object[] { new GenericParameter("T[]"), AddInfo.ParameterType, false }; - yield return new object[] { new GenericParameter("T[]"), AddInfo.ParameterType.MakeArrayType(), true }; - yield return new object[] { new GenericParameter("TArray[]"), ArrayInfo.ParameterType, true }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), ParamInfo.ParameterType, true }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), ParamInfo.ParameterType, true }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), ParamInfo.ParameterType, true }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), ParamInfo.ParameterType, true }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), ArrayInfo.ParameterType, false }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), ArrayInfo.ParameterType, false }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name), typeof(string), false }; + yield return new object[] { new GenericParameter(ParamInfo.ParameterType.Name, string.Empty), typeof(string), false }; + yield return new object[] { new GenericParameter("T[]"), AddInfo.ParameterType, false }; + yield return new object[] { new GenericParameter("T[]"), AddInfo.ParameterType.MakeArrayType(), true }; + yield return new object[] { new GenericParameter("TArray[]"), ArrayInfo.ParameterType, true }; - yield return new object[] { new GenericResolvedArrayParameter("T[]"), typeof(List[]), false }; - yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name), ArrayInfo.ParameterType, true }; + yield return new object[] { new GenericResolvedArrayParameter("T[]"), typeof(List[]), false }; + yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name), ArrayInfo.ParameterType, true }; yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name, string.Empty), ArrayInfo.ParameterType, true }; - yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name), typeof(string), false }; - yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name, string.Empty), typeof(string), false }; - yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name), ParamInfo.ParameterType, false }; + yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name), typeof(string), false }; + yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name, string.Empty), typeof(string), false }; + yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name), ParamInfo.ParameterType, false }; yield return new object[] { new GenericResolvedArrayParameter(ArrayInfo.ParameterType.Name, string.Empty), ParamInfo.ParameterType, false }; } + + #endregion } }