Thank you Alex for your help...

On Wed, Oct 6, 2010 at 7:06 PM, Alex McMahon <fluxmu...@gmail.com> wrote:

> Here's what I meant:
>
> public interface IDependency
> {
>   void Method1();
>   void Method2();
>   void End();
> }
>
> [TestClass()]
> public class Test
> {
>   [TestMethod()]
>   public void EndIsLastMethodCalled()
>   {
>     var dependency = MockRepository.GenerateMock<IDependency>();
>     dependency.Stub(x => x.End()).WhenCalled(a =>
>     {
>       dependency.VerifyAllExpectations();
>     });
>     dependency.Method1();
>     dependency.End();
>   }
>
>   [TestMethod()]
>   [ExpectedException(typeof(InvalidOperationException))]
>   public void EndIsNotLastMethodCalledThrows()
>   {
>     var dependency = MockRepository.GenerateMock<IDependency>();
>     dependency.Stub(x => x.End()).WhenCalled(a =>
>     {
>       dependency.VerifyAllExpectations();
>     });
>     dependency.Method1();
>     dependency.End();
>     dependency.Method2();
>   }
> }
>
>
>
> On 6 October 2010 14:06, k0v1d pa9d3y <pandeyko...@gmail.com> wrote:
>
>> Let me eloborate more on my question:
>> I have to use dynamic mock and I need to make sure that Prop1, Prop2 is
>> getting modified ; but once End() method gets called modification to prop1,
>> prop2 should not be happened...
>>
>> Start()
>> DoSomeProcess1()
>> DoSomeProcess2()
>> DoSomeProcess1()
>> Prop1 = value;
>> Prop2 = value;
>> Prop1 = value;
>> Prop2 = value;
>> End(),
>>
>>
>> On Wed, Oct 6, 2010 at 6:22 PM, k0v1d pa9d3y <pandeyko...@gmail.com>wrote:
>>
>>> Thanks Alex for replying, but I want use Dynamic mock not stub , can you
>>> eloborate your way of doing using WhenCalled(), I did not get it..
>>>
>>>
>>> On Wed, Oct 6, 2010 at 5:08 PM, Alex McMahon <fluxmu...@gmail.com>wrote:
>>>
>>>> I don't know if there's a better way, but I think the following should
>>>> work:
>>>>
>>>> Setup a Stub for End() with a WhenCalled() that does something that
>>>> means any further calls on the mock will fail. I should think calling
>>>> mockObject.VerifyAllExpectations() should probably work... although you'd
>>>> need to verify this.
>>>>
>>>>   On 6 October 2010 12:22, k0v1d pa9d3y <pandeyko...@gmail.com> wrote:
>>>>
>>>>>   How do i make sure that after the particular method called up no
>>>>> other method/ property setter should be called on the same object.
>>>>>
>>>>> Let say I have a method which has three methods,
>>>>>
>>>>> Start()
>>>>> DoSomeProcess1()
>>>>> DoSomeProcess2()
>>>>> DoSomeProcess1()
>>>>> //Some property settings...
>>>>> .....
>>>>> End(),
>>>>>
>>>>> I want to make sure that End() should always be executed at last, no
>>>>> other method should be executed once End gets executed?
>>>>>
>>>>> How can I achieve this using Rhinomock();
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Rhino.Mocks" group.
>>>>> To post to this group, send email to rhinomo...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> rhinomocks+unsubscr...@googlegroups.com<rhinomocks%2bunsubscr...@googlegroups.com>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://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 rhinomo...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> rhinomocks+unsubscr...@googlegroups.com<rhinomocks%2bunsubscr...@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://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 rhinomo...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rhinomocks+unsubscr...@googlegroups.com<rhinomocks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://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 rhinomo...@googlegroups.com.
> To unsubscribe from this group, send email to
> rhinomocks+unsubscr...@googlegroups.com<rhinomocks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://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 rhinomo...@googlegroups.com.
To unsubscribe from this group, send email to 
rhinomocks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.

Reply via email to