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 -


--~--~---------~--~----~------------~-------~--~----~
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