Thursday, February 11, 2010

Accessing Non-Public Members Using Mirrors

MbUnit v3.2 introduces a new feature called Mirrors for accessing non-public members.

Please tell me what you think.  :-)

More on the wiki: Mirrors

Technorati Tags:

3 comments:

dcdietrich said...

Hey Jeff! Now, this is very subjective but in my mind it has the same problem that PrivateObject has - on the caller side you can clearly see that you are dealing with an intermediary so the resulting code looks a bit "unnatural". What I'd like would be more of "transparent proxy", a wrapper with the same interface. I've thought about solving this problem with runtime code generation but until now there was no late-binding in C#. I have something running that is somewhere between prototype and usable and I'd be very interested in what you think:
http://blogs.msdn.com/ddietric/archive/2010/01/24/d-c-and-the-wrapper-factory.aspx

Blog.Runxc said...

So currently I am using VS 2010 and using MBUnit as my Test Framework and I am running the Tests from within Visual Studio. The one question I have is why does Gallios Test Runner run all of the tests in the project when I click on Run all Tests in Current Context? Shouldn't it just run the test in the specific class that I am in?

Thanks

Stanislav Dvoychenko said...

Although I don't like VSTests I have to admit that idea of generation of test accessor classes saves from all those strings and gives the compile time checks in case private fields/methods involved into testing are renamed. VS private accessor solution works more like Dennis "D.C." Dietrich suggestion above.