You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
committed by
Jo Shields
parent
aa7da660d6
commit
c042cd0c52
@@ -828,6 +828,22 @@ namespace MonoTests.System
|
||||
Assert.IsFalse (Attribute.IsDefined (typeof (AttributeTest), typeof(SerializableAttribute), true), "#2");
|
||||
}
|
||||
|
||||
[YourCustomAttribute (0)]
|
||||
[Serializable]
|
||||
[MyCustomAttribute ("")]
|
||||
class ClassForOrderIsImportant
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OrderIsImportant ()
|
||||
{
|
||||
var custom = typeof (ClassForOrderIsImportant).GetCustomAttributes (false);
|
||||
Assert.IsTrue (custom [0].GetType () == typeof (YourCustomAttribute));
|
||||
Assert.IsTrue (custom [1].GetType () == typeof (MyCustomAttribute));
|
||||
Assert.IsTrue (custom [2].GetType () == typeof (SerializableAttribute));
|
||||
}
|
||||
|
||||
#if !MONOTOUCH
|
||||
[Test]
|
||||
public void GetCustomAttributeOnNewSreTypes ()
|
||||
@@ -1013,6 +1029,25 @@ namespace MonoTests.System
|
||||
AttributeWithTypeId a = new AttributeWithTypeId ();
|
||||
a.GetHashCode ();
|
||||
}
|
||||
|
||||
class ArrayAttribute : Attribute
|
||||
{
|
||||
#pragma warning disable 414
|
||||
int[] array;
|
||||
#pragma warning restore
|
||||
|
||||
public ArrayAttribute (int[] array)
|
||||
{
|
||||
this.array = array;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ArrayFieldsEquality ()
|
||||
{
|
||||
Assert.IsTrue (new ArrayAttribute (new int[] { 1, 2 }).Equals (new ArrayAttribute (new int[] { 1, 2 })));
|
||||
Assert.IsFalse (new ArrayAttribute (new int[] { 1, 2 }).Equals (new ArrayAttribute (new int[] { 1, 1 })));
|
||||
}
|
||||
}
|
||||
|
||||
namespace ParamNamespace {
|
||||
@@ -1050,6 +1085,12 @@ namespace MonoTests.System
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class Multiple {
|
||||
public void Bar ([Foo] [Bar] string multiple, [Bar] string bar)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
@@ -1142,6 +1183,24 @@ namespace MonoTests.System
|
||||
Assert.AreEqual ("Derived.baz", attributes [0].Data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MultipleParameterAttributes ()
|
||||
{
|
||||
var parameter = GetParameter (typeof(ParamNamespace.Multiple), "Bar", "multiple");
|
||||
var foo = parameter.GetCustomAttribute<ParamNamespace.FooAttribute> ();
|
||||
Assert.AreEqual (typeof(ParamNamespace.FooAttribute), foo.GetType ());
|
||||
var bar = parameter.GetCustomAttribute<ParamNamespace.BarAttribute> ();
|
||||
Assert.AreEqual (typeof(ParamNamespace.BarAttribute), bar.GetType ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MultipleParameterAttributes2 ()
|
||||
{
|
||||
var parameter = GetParameter (typeof(ParamNamespace.Multiple), "Bar", "bar");
|
||||
var foo = parameter.GetCustomAttribute<ParamNamespace.FooAttribute> ();
|
||||
Assert.IsNull (foo);
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Class)]
|
||||
public class MyCAttr : Attribute {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user