|
|
|
@ -331,9 +331,10 @@ public class CommonTests : GeneratorTestFixture |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public unsafe void TestIndexers() |
|
|
|
public void TestIndexers() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
using (var indexedProperties = new TestIndexedProperties()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var indexedProperties = new TestIndexedProperties(); |
|
|
|
|
|
|
|
Assert.AreEqual(1, indexedProperties[0]); |
|
|
|
Assert.AreEqual(1, indexedProperties[0]); |
|
|
|
Assert.AreEqual(1, indexedProperties["foo"]); |
|
|
|
Assert.AreEqual(1, indexedProperties["foo"]); |
|
|
|
indexedProperties[0] = 2; |
|
|
|
indexedProperties[0] = 2; |
|
|
|
@ -350,14 +351,20 @@ public class CommonTests : GeneratorTestFixture |
|
|
|
Assert.AreEqual(4, newProperties.Field); |
|
|
|
Assert.AreEqual(4, newProperties.Field); |
|
|
|
newProperties.Field = 5; |
|
|
|
newProperties.Field = 5; |
|
|
|
Assert.AreEqual(5, indexedProperties[(byte) 0].Field); |
|
|
|
Assert.AreEqual(5, indexedProperties[(byte) 0].Field); |
|
|
|
|
|
|
|
var bar = new Bar { A = 5 }; |
|
|
|
|
|
|
|
indexedProperties[0u] = bar; |
|
|
|
|
|
|
|
Assert.That(bar.A, Is.EqualTo(indexedProperties[0u].A)); |
|
|
|
|
|
|
|
indexedProperties[(ushort) 0] = bar; |
|
|
|
|
|
|
|
Assert.That(bar.A, Is.EqualTo(indexedProperties[(ushort) 0].A)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public unsafe void TestOperators() |
|
|
|
public void TestOperators() |
|
|
|
{ |
|
|
|
{ |
|
|
|
var @class = new ClassWithOverloadedOperators(); |
|
|
|
var @class = new ClassWithOverloadedOperators(); |
|
|
|
Assert.AreEqual(1, (char) @class); |
|
|
|
Assert.AreEqual(1, (char) @class); |
|
|
|
Assert.AreEqual(2, (int) @class); |
|
|
|
Assert.AreEqual(2, @class); |
|
|
|
Assert.AreEqual(3, (short) @class); |
|
|
|
Assert.AreEqual(3, (short) @class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|