SPRSPRNET-998

Fixing broken build (inferred array typing and in-line initialization are also no-nos under .NET 2.0...you'd think I'd start to be catching on to this by now, eh?) /slaps self on back of hand/
This commit is contained in:
sbohlen
2010-08-09 15:42:55 +00:00
parent 5791c6eefc
commit fb81403684

View File

@@ -594,6 +594,32 @@ namespace Spring.Util
}
}
[Test]
public void CreatCustomAttriubtesFromCustomAttributeDataWithSimpleTypeSetInConstructor()
{
MethodInfo mi = typeof(TestClassHavingAttributeWithSimpleTypeSetInConstructor).GetMethod("SomeMethod");
System.Collections.Generic.IList<CustomAttributeData> attributes = CustomAttributeData.GetCustomAttributes(mi);
CustomAttributeBuilder builder = null;
foreach (CustomAttributeData customAttributeData in attributes)
{
builder = ReflectionUtils.CreateCustomAttribute(customAttributeData);
Assert.IsNotNull(builder);
}
}
[Test]
public void CreatCustomAttriubtesFromCustomAttributeDataWithGenericCollectionTypeSetInConstructor()
{
MethodInfo mi = typeof(TestClassHavingAttributeWithGenericCollectionTypeSetInConstructor).GetMethod("SomeMethod");
System.Collections.Generic.IList<CustomAttributeData> attributes = CustomAttributeData.GetCustomAttributes(mi);
CustomAttributeBuilder builder = null;
foreach (CustomAttributeData customAttributeData in attributes)
{
builder = ReflectionUtils.CreateCustomAttribute(customAttributeData);
Assert.IsNotNull(builder);
}
}
internal interface IHaveSomeMethod
{
void SomeMethod();
@@ -604,14 +630,33 @@ namespace Spring.Util
[AttributeWithEnum(SomeProperty = TheTestEnumThing.One)]
public void SomeMethod()
{
}
}
internal class TestClassHavingAttributeWithEnumArraySetInConstructor : IHaveSomeMethod
{
[AttributeWithEnumArraySetInConstructor(new[] { TheTestEnumThing.One, TheTestEnumThing.Three })]
[AttributeWithEnumArraySetInConstructor(new TheTestEnumThing[]{TheTestEnumThing.One, TheTestEnumThing.Two})]
public void SomeMethod()
{
}
}
internal class TestClassHavingAttributeWithSimpleTypeSetInConstructor : IHaveSomeMethod
{
[AttributeWithType(typeof(int))]
public void SomeMethod()
{
}
}
internal class TestClassHavingAttributeWithGenericCollectionTypeSetInConstructor : IHaveSomeMethod
{
[AttributeWithType(typeof(System.Collections.Generic.List<int>))]
public void SomeMethod()
{
@@ -620,7 +665,7 @@ namespace Spring.Util
internal class TestClassHavingAttributeWithEnumArraySetOnProperty : IHaveSomeMethod
{
[AttributeWithEnumArray(SomeProperty = new[] { TheTestEnumThing.One, TheTestEnumThing.Three })]
[AttributeWithEnumArray(SomeProperty = new TheTestEnumThing[] { TheTestEnumThing.One, TheTestEnumThing.Three })]
public void SomeMethod()
{
@@ -631,7 +676,19 @@ namespace Spring.Util
{
One, Two, Three
}
internal class AttributeWithTypeAttribute : Attribute
{
public AttributeWithTypeAttribute(Type T)
{
}
}
internal class AttributeWithEnumArrayAttribute : Attribute
{
private TheTestEnumThing[] _someProperty;
@@ -653,7 +710,7 @@ namespace Spring.Util
/// </summary>
public AttributeWithEnumArraySetInConstructorAttribute(TheTestEnumThing[] things)
{
}
}
@@ -669,7 +726,7 @@ namespace Spring.Util
_someProperty = value;
}
}
}