mirror of https://github.com/mono/CppSharp.git
c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1011 B
37 lines
1011 B
using System; |
|
using System.Reflection; |
|
using CSharpTemp; |
|
using NUnit.Framework; |
|
using Foo = CSharpTemp.Foo; |
|
|
|
[TestFixture] |
|
public class CSharpTempTests |
|
{ |
|
[Test] |
|
public unsafe void TestIndexer() |
|
{ |
|
var foo = new Foo(); |
|
|
|
// TODO: Most of the ugliness below will disappear when pointers to simple types are represented by C#-pointers or ref modifiers instead of the nasty IntPtr |
|
var value = *foo[0]; |
|
Assert.That(value, Is.EqualTo(50)); |
|
int x = 250; |
|
foo[0] = &x; |
|
value = *foo[0]; |
|
Assert.That(value, Is.EqualTo(x)); |
|
|
|
Assert.That(foo[(uint) 0], Is.EqualTo(15)); |
|
|
|
var bar = new Bar(); |
|
Assert.That(bar[0].A, Is.EqualTo(10)); |
|
bar[0] = new Foo { A = 25 }; |
|
Assert.That(bar[0].A, Is.EqualTo(25)); |
|
} |
|
|
|
[Test] |
|
public void TestPropertyAccessModifier() |
|
{ |
|
Assert.That(typeof(Foo).GetProperty("P", |
|
BindingFlags.Instance | BindingFlags.NonPublic), Is.Not.Null); |
|
} |
|
} |