[RhinoMocks] Ordered expectations
Sorry for battering the list with a host of questions in a short period of time, but I am new to Rhino Mocks (like yesterday) and absolutely loving it! Unfortunately, the only documentation I have found (http://ayende.com/Wiki/Rhino+Mocks+3.5.ashx) does not answer all my questions! I want to be able to assert that two methods on a Mock have been called in a particular order, does anyone know the fluent syntax for this? Thanks Colin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Re: Multiple expectations on the same method
Interestingly, I did try this but it failed because the object being mocked (a WinForm ComboBox) is a concrete class and the property being tested BackColor is not virtual. The AssertWasCalled did work though! Colin On Jan 21, 2:55 pm, Tim Barcz wrote: > Glad to help > > You could also write using Lain's example: > > mockObj.Expect(x=>x.SomeMethod()).Repeat.Time(3)) > > (just depends on how you prefer things). > > On Wed, Jan 21, 2009 at 8:52 AM, Colin Desmond < > > colin.desm...@btopenworld.com> wrote: > > > Excellent, thanks this worked just fine. > > > Colin. > > > On Jan 21, 2:28 pm, Tim Barcz wrote: > > > var mockObj = MockRepository.GenerateMock(); > > > > ... > > > > mockObj.AssertWasCalled(x=>x.SomeMethod(), o=>o.Repeat.Times(3)); > > > > On Wed, Jan 21, 2009 at 8:21 AM, Colin Desmond < > > > > colin.desm...@btopenworld.com> wrote: > > > > > I want to check that a particular method is called 3 times on a single > > > > mocked instance, is there a way of expressing this in Rhino Mocks 3.5? > > > > In particular, if it is only called twice, I want the test to fail. > > > > > Many thanks > > > > > Colin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Re: Multiple expectations on the same method
Excellent, thanks this worked just fine. Colin. On Jan 21, 2:28 pm, Tim Barcz wrote: > var mockObj = MockRepository.GenerateMock(); > > ... > > mockObj.AssertWasCalled(x=>x.SomeMethod(), o=>o.Repeat.Times(3)); > > On Wed, Jan 21, 2009 at 8:21 AM, Colin Desmond < > > colin.desm...@btopenworld.com> wrote: > > > I want to check that a particular method is called 3 times on a single > > mocked instance, is there a way of expressing this in Rhino Mocks 3.5? > > In particular, if it is only called twice, I want the test to fail. > > > Many thanks > > > Colin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Multiple expectations on the same method
I want to check that a particular method is called 3 times on a single mocked instance, is there a way of expressing this in Rhino Mocks 3.5? In particular, if it is only called twice, I want the test to fail. Many thanks Colin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Re: Set only properties
Excellent, thank you Phil. Colin On Jan 19, 3:52 pm, Phil wrote: > try: m_contactPresenter.ContactAdapter.AssertWasCalled(a => a.Names = > null); > > On Jan 19, 3:03 am, Colin Desmond > wrote: > > > In the fluent syntax is it possible to test whether a set only > > property (not get method defined) is called. I am not too bothered > > about the parameters being passed. > > > So far I have tried: > > > m_contactPresenter.ContactAdapter.AssertWasCalled(a => a.Names); > > > and > > > Expect.Call > > (m_contactPresenter.ContactAdapter.Names).SetPropertyAndIgnoreArgument > > (); > > > But I keep getting > > > The property or indexer 'CoreLibrary.Contact.IContactAdapter.Names' > > cannot be used in this context because it lacks the get accessor. > > > Thanks again, > > > Colin. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Re: System.TypeLoadException when using MockRepository
OK, I am happy with that as a solution. Colin. On Jan 19, 12:45 pm, Ayende Rahien wrote: > The issue is a problem with modopt in the CLR.Since it is the same thing > from your perspective, please use int > > On Mon, Jan 19, 2009 at 5:24 AM, Colin Desmond < > > colin.desm...@btopenworld.com> wrote: > > > OK, > > > If I change the C++/CLI syntax from > > > CoreLibrary::Common::IMSMContact^ LoadSMContact(long nId); > > > to > > > CoreLibrary::Common::IMSMContact^ LoadSMContact(int nId); > > > it all works, it doesn't like the long. This is interesting given that > > "int" and "long" both map to System.Int32! > > > Colin > > > On Jan 19, 9:32 am, Colin Desmond > > wrote: > > > We're using 3.5 SP1. > > > > When I rewrite the interface as C# it is happy. I'll try playing with > > > the C++/CLI syntax a little and see if I can get it to work. > > > > Colin > > > > On Jan 18, 9:15 pm, Ayende Rahien wrote: > > > > > what version of the runtime?if you write the same thing in C#, does it > > cause > > > > any issues? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Set only properties
In the fluent syntax is it possible to test whether a set only property (not get method defined) is called. I am not too bothered about the parameters being passed. So far I have tried: m_contactPresenter.ContactAdapter.AssertWasCalled(a => a.Names); and Expect.Call (m_contactPresenter.ContactAdapter.Names).SetPropertyAndIgnoreArgument (); But I keep getting The property or indexer 'CoreLibrary.Contact.IContactAdapter.Names' cannot be used in this context because it lacks the get accessor. Thanks again, Colin. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Re: System.TypeLoadException when using MockRepository
OK, If I change the C++/CLI syntax from CoreLibrary::Common::IMSMContact^ LoadSMContact(long nId); to CoreLibrary::Common::IMSMContact^ LoadSMContact(int nId); it all works, it doesn't like the long. This is interesting given that "int" and "long" both map to System.Int32! Colin On Jan 19, 9:32 am, Colin Desmond wrote: > We're using 3.5 SP1. > > When I rewrite the interface as C# it is happy. I'll try playing with > the C++/CLI syntax a little and see if I can get it to work. > > Colin > > On Jan 18, 9:15 pm, Ayende Rahien wrote: > > > what version of the runtime?if you write the same thing in C#, does it cause > > any issues? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---
[RhinoMocks] Re: System.TypeLoadException when using MockRepository
We're using 3.5 SP1. When I rewrite the interface as C# it is happy. I'll try playing with the C++/CLI syntax a little and see if I can get it to work. Colin On Jan 18, 9:15 pm, Ayende Rahien wrote: > what version of the runtime?if you write the same thing in C#, does it cause > any issues? > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to RhinoMocks@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 -~--~~~~--~~--~--~---