public void ResolveNullableDecimal() { Assert.AreEqual(typeof(decimal?), TypeRegistry.ResolveType(TypeRegistry.NullableDecimalAlias)); Assert.AreEqual(typeof(Nullable <decimal>), TypeRegistry.ResolveType(TypeRegistry.NullableDecimalAlias)); }
public void ResolveNullableFloat() { Assert.AreEqual(typeof(float?), TypeRegistry.ResolveType(TypeRegistry.NullableFloatAlias)); Assert.AreEqual(typeof(Nullable <float>), TypeRegistry.ResolveType(TypeRegistry.NullableFloatAlias)); }
public void ResolveNullableUnsignedInteger() { Assert.AreEqual(typeof(uint?), TypeRegistry.ResolveType(TypeRegistry.NullableUInt32Alias)); Assert.AreEqual(typeof(Nullable <uint>), TypeRegistry.ResolveType(TypeRegistry.NullableUInt32Alias)); }
public void ResolveNullableUnsignedLong() { Assert.AreEqual(typeof(ulong?), TypeRegistry.ResolveType(TypeRegistry.NullableUInt64Alias)); Assert.AreEqual(typeof(Nullable <ulong>), TypeRegistry.ResolveType(TypeRegistry.NullableUInt64Alias)); }
public void ResolveNullableDouble() { Assert.AreEqual(typeof(double?), TypeRegistry.ResolveType(TypeRegistry.NullableDoubleAlias)); Assert.AreEqual(typeof(Nullable <double>), TypeRegistry.ResolveType(TypeRegistry.NullableDoubleAlias)); }
public void ResolveNullableShort() { Assert.AreEqual(typeof(short?), TypeRegistry.ResolveType(TypeRegistry.NullableInt16Alias)); Assert.AreEqual(typeof(Nullable <short>), TypeRegistry.ResolveType(TypeRegistry.NullableInt16Alias)); }
public void ResolveNullableUnsignedShort() { Assert.AreEqual(typeof(ushort?), TypeRegistry.ResolveType(TypeRegistry.NullableUInt16Alias)); Assert.AreEqual(typeof(Nullable <ushort>), TypeRegistry.ResolveType(TypeRegistry.NullableUInt16Alias)); }
public void ResolveNullableBool() { Assert.AreEqual(typeof(bool?), TypeRegistry.ResolveType(TypeRegistry.NullableBoolAlias)); Assert.AreEqual(typeof(Nullable <bool>), TypeRegistry.ResolveType(TypeRegistry.NullableBoolAlias)); }
public void ResolveNullableChar() { Assert.AreEqual(typeof(char?), TypeRegistry.ResolveType(TypeRegistry.NullableCharAlias)); Assert.AreEqual(typeof(Nullable <char>), TypeRegistry.ResolveType(TypeRegistry.NullableCharAlias)); }
public void ResolveNullableLong() { Assert.AreEqual(typeof(long?), TypeRegistry.ResolveType(TypeRegistry.NullableInt64Alias)); Assert.AreEqual(typeof(Nullable <long>), TypeRegistry.ResolveType(TypeRegistry.NullableInt64Alias)); }
// CLOVER:ON #endregion #region Methods /// <summary> /// Resolves the supplied type name into a <see cref="System.Type"/> /// instance. /// </summary> /// <remarks> /// <p> /// If you require special <see cref="System.Type"/> resolution, do /// <b>not</b> use this method, but rather instantiate /// your own <see cref="Oragon.Spring.Core.TypeResolution.TypeResolver"/>. /// </p> /// </remarks> /// <param name="typeName"> /// The (possibly partially assembly qualified) name of a /// <see cref="System.Type"/>. /// </param> /// <returns> /// A resolved <see cref="System.Type"/> instance. /// </returns> /// <exception cref="System.TypeLoadException"> /// If the type cannot be resolved. /// </exception> public static Type ResolveType(string typeName) { Type type = TypeRegistry.ResolveType(typeName); if (type == null) { type = internalTypeResolver.Resolve(typeName); } return(type); }
public void RegisteringAnAliasTwiceDoesNotThrowException() { const string Alias = "foo"; TypeRegistry.RegisterType(Alias, typeof(TestObject)); TypeRegistry.RegisterType(Alias, GetType()); Type type = TypeRegistry.ResolveType(Alias); Assert.AreEqual(GetType(), type, "Overriding Type was not registered."); }
public void TestAliasResolution() { TypeRegistry.RegisterType("Foo", typeof(Foo)); TypeRegistry.RegisterType("Bar", "Oragon.Spring.Objects.Factory.Bar, Oragon.Spring.Core.Tests"); Assert.AreEqual(TypeRegistry.ResolveType("Foo"), typeof(Foo)); Assert.AreEqual(TypeRegistry.ResolveType("Bar"), typeof(Bar)); IApplicationContext ctx = new XmlApplicationContext("assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Core.TypeResolution/aliasedObjects.xml"); Foo foo = ctx.GetObject("aliasedType") as Foo; Assert.IsNotNull(foo); Assert.IsNotNull(foo.Bar); Assert.AreEqual(foo.Bar, typeof(Bar)); Assert.IsTrue(typeof(IBar).IsAssignableFrom(foo.Bar)); }
public void ResolveNullableFloatArray() { Assert.AreEqual(typeof(float?[]), TypeRegistry.ResolveType(TypeRegistry.NullableFloatArrayAlias)); }
public void ResolveNullableBoolArray() { Assert.AreEqual(typeof(bool?[]), TypeRegistry.ResolveType(TypeRegistry.NullableBoolArrayAlias)); }
public void ResolveNullableUInt64Array() { Assert.AreEqual(typeof(ulong?[]), TypeRegistry.ResolveType(TypeRegistry.NullableUInt64ArrayAlias)); }
public void ResolveNullableInt16Array() { Assert.AreEqual(typeof(short?[]), TypeRegistry.ResolveType(TypeRegistry.NullableInt16ArrayAlias)); }
public void ResolveTypeWithNullAliasArg() { Assert.Throws <ArgumentNullException>(() => TypeRegistry.ResolveType(null)); }
public void ResolveVBSingleArray() { Assert.AreEqual(typeof(float[]), TypeRegistry.ResolveType(TypeRegistry.SingleArrayAliasVB)); }
public void ResolveTypeWithWhitespacedAliasArg() { Assert.Throws <ArgumentNullException>(() => TypeRegistry.ResolveType(" ")); }
public void ResolveVBInt64Array() { Assert.AreEqual(typeof(long[]), TypeRegistry.ResolveType(TypeRegistry.Int64ArrayAliasVB)); }
public void ResolveUInt32Array() { Assert.AreEqual(typeof(uint[]), TypeRegistry.ResolveType(TypeRegistry.UInt32ArrayAlias)); }
public void ResolveVBCharArray() { Assert.AreEqual(typeof(char[]), TypeRegistry.ResolveType(TypeRegistry.CharArrayAliasVB)); }
public void ResolveVBBoolArray() { Assert.AreEqual(typeof(bool[]), TypeRegistry.ResolveType(TypeRegistry.BoolArrayAliasVB)); }
public void ResolveVBDateArray() { Assert.AreEqual(typeof(DateTime[]), TypeRegistry.ResolveType(TypeRegistry.DateTimeArrayAliasVB)); }
public void ResolveTypeWithEmptyAliasArg() { Assert.Throws <ArgumentNullException>(() => TypeRegistry.ResolveType(string.Empty)); }
public void ResolveNullableDoubleArray() { Assert.AreEqual(typeof(double?[]), TypeRegistry.ResolveType(TypeRegistry.NullableDoubleArrayAlias)); }
public void ResolveVBInt16Array() { Assert.AreEqual(typeof(short[]), TypeRegistry.ResolveType(TypeRegistry.Int16ArrayAliasVB)); }
public void ResolveNullableCharArray() { Assert.AreEqual(typeof(char?[]), TypeRegistry.ResolveType(TypeRegistry.NullableCharArrayAlias)); }
public void ResolveVBDoubleArray() { Assert.AreEqual(typeof(double[]), TypeRegistry.ResolveType(TypeRegistry.DoubleArrayAliasVB)); }