Thanks guys, this is exactly what I was lookin for. I added the reference for MbUnit.Framework.2.0 (Which had the Reflection code) copied Vadim's example and it worked perfectly. Thanks again -SteveM
On Mar 19, 10:02 am, "Andrew Stopford" <[EMAIL PROTECTED]> wrote: > HI Chris, > > Hi Chris > > Just checking that your trunk folder is linked to the 2.4 release? > > Can you try an example of Vadims against the 143 release and let us know if > its not working for you or not the behaviour you have in mind? > > Thanjs > > Andy > > On 3/19/07, Chris Bilson <[EMAIL PROTECTED]> wrote: > > > > > > > I grabbed 2.4.143 from the link Andrew gave, and am still not seeing a > > RunPrivateMethod that accepts extra args (see attached screenshot.) > > > Also, I was working off the trunk for 2.4 and didn't see it in the source. > > > I must be confused. Maybe I am looking at the wrong assembly/source file? > > > If RunPrivateMethods accepts params already, please disregard my earlier > > comment and patch. Sorry for the confusion. > > > On 3/19/07, Vadim <[EMAIL PROTECTED]> wrote: > > > > I just want to confirm that the code above was compiled and tested > > > with version 2.4.143. > > > > Vadim > > > > On Mar 19, 9:00 am, "Andrew Stopford" <[EMAIL PROTECTED] > wrote: > > > > Hi Guys, > > > > > Vadims work was included in 141. > > > > > 143 is available > > > > >http://www.mbunit.com/builds/MbUnit-2.4.143.exe > > > > > 145 will be beta 2 and will be cut today or tommrow with luck. > > > > > I've not had a chance to apply your patch yet Chris, if Vadim's work > > > > address's your issue then let us know. > > > > > Andy > > > > > On 3/19/07, Chris Bilson <[EMAIL PROTECTED]> wrote: > > > > > > In your example, it looks like you are able to pass params to > > > > > RunPrivateMethod. This doesn't appear to be checked in (?). When I > > > first > > > > > heard about the Reflector class (a few weeks ago), this is the first > > > thing I > > > > > wanted to add. I submitted a (very small) patch to add a params to > > > > > RunPrivateMethod to Andrew yesterday. Was this something that was > > > already > > > > > there? > > > > > > On 3/18/07, Vadim < [EMAIL PROTECTED]> wrote: > > > > > > > Here how it works. > > > > > > > Let assume that we have SampleClass with private field, property > > > and > > > > > > method: > > > > > > > public class SampleClass > > > > > > { > > > > > > private string _privateStringField = "Test"; > > > > > > > private string PrivateStringProperty > > > > > > { > > > > > > get { return _privateStringField; } > > > > > > } > > > > > > > private int PrivateMethod(int x, int y) > > > > > > { > > > > > > return x + y; > > > > > > } > > > > > > } > > > > > > > It looks simple enough. And here how you would test it. You will > > > > > > need to add reference to MbUnit.Framework.2.0.dll in order to use > > > > > > Reflector class. > > > > > > > using MbUnit.Framework; > > > > > > using MbUnit.Framework.Reflection; > > > > > > > namespace MbUnitPrivate > > > > > > { > > > > > > [TestFixture] > > > > > > public class SampleTests > > > > > > { > > > > > > Reflector _reflector; > > > > > > > [SetUp] > > > > > > public void Init() > > > > > > { > > > > > > SampleClass sc = new SampleClass(); > > > > > > _reflector = new Reflector(sc); > > > > > > } > > > > > > > [Test] > > > > > > public void NonPublicField_Test() > > > > > > { > > > > > > object result = > > > > > > _reflector.GetNonPublicField("_privateStringField"); > > > > > > Assert.AreEqual("Test", result); > > > > > > } > > > > > > > [Test] > > > > > > public void NonPublicProperty_Test() > > > > > > { > > > > > > object result = > > > > > > _reflector.GetNonPublicProperty("PrivateStringProperty"); > > > > > > Assert.AreEqual("Test", result); > > > > > > } > > > > > > > [Test] > > > > > > public void PrivateMethod_Test() > > > > > > { > > > > > > object result = > > > > > > _reflector.RunPrivateMethod("PrivateMethod", 5, 7); > > > > > > Assert.AreEqual(12, result); > > > > > > } > > > > > > } > > > > > > } > > > > > > > Hope it helps. > > > > > > > Vadim > > > > > > > On Mar 16, 2:52 pm, "SteveM" <[EMAIL PROTECTED] > wrote: > > > > > > > I see that the latest download ( 2.4) has added the capability > > > to test > > > > > > > private methods. This is exactly what I have been looking for, > > > Are > > > > > > > there any examples or documentation on this new feature > > > anywhere? > > > > > > > > Thanks > > > > > > > -SteveM > > > > > > -- > > > > > --c- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
