}
[Test]
+ [Category ("only")]
public void Type_SetValue () {
var e = run_until ("o1");
var frame = e.Thread.GetFrames () [0];
f = o.Type.GetValue (o.Type.GetField ("static_i"));
AssertValue (55, f);
+ o.Type.SetValue (o.Type.GetField ("static_s"), vm.RootDomain.CreateString ("B"));
+ f = o.Type.GetValue (o.Type.GetField ("static_s"));
+ AssertValue ("B", f);
+
// Argument checking
AssertThrows<ArgumentNullException> (delegate () {
o.Type.SetValue (null, vm.CreateValue (0));
});
}
+ [Test]
+ [Category ("only")]
+ public void CreateBoxedValue () {
+ ObjectMirror o = vm.RootDomain.CreateBoxedValue (new PrimitiveValue (vm, 42));
+
+ Assert.AreEqual ("Int32", o.Type.Name);
+ //AssertValue (42, m.GetValue (o.Type.GetField ("m_value")));
+
+ // Argument checking
+ AssertThrows <ArgumentNullException> (delegate () {
+ vm.RootDomain.CreateBoxedValue (null);
+ });
+
+ AssertThrows <ArgumentException> (delegate () {
+ vm.RootDomain.CreateBoxedValue (o);
+ });
+ }
+
[Test]
public void Invoke () {
Event e = run_until ("invoke1");
}
[Test]
- [Category ("only")]
public void InvokeVType () {
Event e = run_until ("invoke1");
m = t.GetMethod ("invoke_return_intptr");
v = s.InvokeMethod (e.Thread, m, null);
AssertValue (43, v);
+
+ // Static method
+ m = t.GetMethod ("invoke_static");
+ v = t.InvokeMethod (e.Thread, m, null);
+ AssertValue (5, v);
+
+ // Pass generic struct as this
+ s = frame.GetArgument (2) as StructMirror;
+ t = s.Type;
+ m = t.GetMethod ("invoke_return_int");
+ v = s.InvokeMethod (e.Thread, m, null);
+ AssertValue (42, v);
}
[Test]
Assert.AreEqual (ThreadState.Running, e.Thread.ThreadState);
+ Assert.IsTrue (e.Thread.ThreadId > 0);
+
vm.EnableEvents (EventType.ThreadStart, EventType.ThreadDeath);
vm.Resume ();