Based on Nima and Steve's input, I have added a new class to MbUnit v3.2 to
make it easier to manipulate non-public members.

Mirror is intended as a replacement for the old Reflector class.
Consequently Reflector has been deprecated and moved to the
MbUnit.Compatibility assembly.

Download beta 3.2 build here: http://ccnet.gallio.org/Distributables/

Here are some example usages:

var mirror = Mirror.ForObject(myObject);

myObject["PrivateProperty"].Value = 42;

int x = (int) myObject["PrivateField"].Value;

myObject["PrivateMethod"].Invoke("a", "b", "c");

myObject["PrivateGenericMethod"].WithGenericArgs(typeof(object)).Invoke();

myObject["PrivateEvent"].AddHandler((sender, e) => { ... });

Please let me know what you think.  I spent a bit of time on this feature
including adding support for automatically coercing event handler delegates
so that you can wire up event handlers even if the event type is
inaccessible.  (See ProxyUtils.CoerceDelegate.)

Cheers,
Jeff

--

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.


Reply via email to