I'm not sure if the Reflector abstraction supports it (we will be revisiting
it again for MbUnit v3 later) but you can invoke methods with out params
directly.
Given:
private void MyMethod(string a, string b, out string c) { ... }
Then:
MethodInfo method = type.GetMethod("MyMethod", BindingFlags.NonPublic |
BindingFlags.Instance);
object[] args = new object[] { "arg1", "arg2", null };
method.Invoke(instance, args);
// On exit, the 3rd slot in the arg array will be set to the output
parameter value.
Assert.AreEqual("arg3", args[2]);
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Max
Sent: Tuesday, June 17, 2008 8:07 AM
To: MbUnit.User
Subject: MbUnit Testing Private Methods with Out Parameters
I am trying to use reflector to test a private method that has out
parameters, however, when I run the test Reflector complains that it can't
find the method. NB when I set up the params to the params array I cannot
use the out modifier as this generates a compiler error.
Can this be done and if so, what is the syntax?
Thanks,
Max
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---