yes, i would like to know if Start() was called inside the
TimerMethod().


On Nov 6, 1:36 pm, Mark Wilkinson <[email protected]> wrote:
> so you want to find out if Start() is called?
>
>
>
>
>
>
>
> >________________________________
> > From: E Jo <[email protected]>
> >To: Rhino.Mocks <[email protected]>
> >Sent: Tuesday, November 6, 2012 2:30 PM
> >Subject: [RhinoMocks] Re: Fw: Newbie, need help with simple mock for void 
> >method
>
> >System - as in the Namespace "using System.IO" or the class.
>
> >The code below is the class I'm trying to test:
>
> >======================
> >public class TimerControl : ITimerControl
> >{
> >      Public TimerControl()
> >      {
> >      }
>
> >      Public void TimerMethod()
> >      {
> >           Start();
> >      }
> >}
>
> >======================
>
> >I just want to know if TimerMethod() was fired.
>
> >I've seen various ways of checking the void method within this Google
> >Group, but they have layers of layers of code, my code is just simple.
> >It has a empty constructor (which will be filled later) and void
> >methods for different flows. My TimerControl Class just has void
> >methods w/out parameters. I just want to test the flow, in which i
> >want to know if the TimerMethod was executed.
>
> >On Nov 6, 1:15 pm, Mark Wilkinson <[email protected]> wrote:
> >> Sorry here's my answer:
>
> >> >You're not testing anything.
>
> >> >If you're creating a mock then the system under test needs to use that 
> >> >mock.
>
> >> >You have no system under test inside this TestClass.
>
> >> >A system under test would be the consumer of this interface.
>
> >> >in this case you'd use it like:
>
> >> >myClass.SomeMethod(); // in SomeMethod you expect TimerMethod to be 
> >> >called or not to be called, based on the logic inside that method.
>
> >> >then your next line would be:
>
> >> >target.AssertWasNotCalled(method=>Method.TimerMethod());
>
> >> >>________________________________
> >> >> From: E Jo <[email protected]>
> >> >>To: Mark Wilkinson <[email protected]>
> >> >>Sent: Tuesday, November 6, 2012 12:33 PM
> >> >>Subject: Re: Newbie, need help with simple mock for void method
>
> >> >>[TestClass]
> >> >>public Class
>
> >>  TimerControllerTest
>
> >> >>{
> >> >>       [TestMethod]
> >> >>       public void TimerMethod_Test1()
> >> >>       {
> >> >>         ITimerControl target =
> >> >>MockRepository.GenerateMock<ITimerControl>();
>
> >> >>         target.AssertWasNotCalled(method=>Method.TimerMethod());
> >> >>       }
>
> >> >>       [TestMethod]
> >> >>       public void TimerMethod_Test2()
> >> >>       {
> >> >>           ITimerControl mock =
> >> >>MockRepository.GenerateMock<ITimerControl>();
>
> >> >>           Expect.Call( mock.TimerMethod);
> >> >>       }
>
> >> >>}
>
> >> >>On Nov 6, 11:24 am, Mark Wilkinson <[email protected]> wrote:
> >> >>> can you post the whole Unit Test class, the
>
> >>  TestFixture you're using for this code below.
>
> >> >>> >________________________________
> >> >>> > From: E Jo <[email protected]>
> >> >>> >To: [email protected]
> >> >>> >Sent: Tuesday, November 6, 2012 12:02 PM
> >> >>> >Subject: [RhinoMocks] Newbie, need help with simple mock for void 
> >> >>> >method
>
> >> >>> >Can anyone help with a simple mock for void methods. I'm been trying 
> >> >>> >all the suggested examples and still cannot the method to be mock 
> >> >>> >correctly.
>
> >> >>> >Below is the code example:
>
> >> >>> >==================================
>
> >> >>> >public class TimerControl : ITimerControl
> >> >>> >{
>
> >> >>> >Public void TimerMethod()
>
> >>  >{
> >> >>> >           Start();
> >> >>> >}
>
> >> >>> >}
>
> >> >>> >==================================
>
> >> >>> >I've tried the following and it won't work.
>
> >> >>> >ITimerControl target = MockRepository.GenerateMock<ITimerControl>();
>
> >> >>> >target.AssertWasNotCalled(method=>Method.TimerMethod());
>
> >> >>> >============  this did not do nothing, it did not hit the TimerMethod.
>
> >> >>> >And the tried the following also:
>
> >> >>> >ITimerControl mock = MockRepository.GenerateMock<ITimerControl>();
>
> >> >>> >Expect.Call( mock.TimerMethod);
>
> >> >>> >=========== no success.
>
> >> >>> >I'm new to Unit testing and tried very hard to find tutorials on 
> >> >>> >Rhino Mock and read the documentation, but I'm still a noob in rhino 
> >> >>> >mock and unit testing. Any help with this simple
> >>  mock?
>
> >> >>> >-EJ
>
> >> >>> >--
> >> >>> >You received this message because you are subscribed to the Google 
> >> >>> >Groups "Rhino.Mocks" group.
> >> >>> >To view this discussion on the web 
> >> >>> >visithttps://groups.google.com/d/msg/rhinomocks/-/AUuQUe42OO4J.
> >> >>> >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 
> >> >>> >athttp://groups.google.com/group/rhinomocks?hl=en.
>
> >--
> >You received this message because you are subscribed to the Google Groups 
> >"Rhino.Mocks" 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 
> >athttp://groups.google.com/group/rhinomocks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" 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/rhinomocks?hl=en.

Reply via email to