Hi Ayende Rahien, In record() mode I am expecting call on mockService. mockService.RequestResponse(reqRequest); After this statement I am using LastCall. LastCall.On(mockService).Return(respRequest);
In playback() I am calling the function using realService. realService.RequestResponse(reqRequest); Regards, Nagaraju On Oct 3, 11:27 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote: > Where are you calling the LastCall.On? And what are you passing it? > > > > On Fri, Oct 3, 2008 at 6:03 PM, Raju <[EMAIL PROTECTED]> wrote: > > > Hi Ayende Rahien, > > > I dont know about transparent proxy. We have been given API that uses > > createservice. > > > I am having a webservice hosted. I am connecting to it using > > realService object. I am using mockService to mock the IService > > functionality. > > When I make a call to a function with realService, mockService should > > get a call and it should return the value with what I am giving. > > > This two threads are working properly if we execute it each alone > > commenting other one. But they are not working in parallel. > > > Regards, > > Nagaraju. > > > On Oct 3, 10:52 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote: > > > If you are passing the transparent proxy, it would not work. > > > What exactly are you doing? What is mockService? > > > > On Fri, Oct 3, 2008 at 5:34 PM, Raju <[EMAIL PROTECTED]> > > wrote: > > > > > Hi Ayende Rahien, > > > > > I think you have mistaken it. I have commented the > > > > simcontrol.lastcall<> and replaced it with LastCall.On. > > > > It was the same error. > > > > > I even used Expect.On, it is giving error as "is not a mocked > > > > instance". > > > > > Regards, > > > > Nagaraju > > > > > On Oct 3, 10:24 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote: > > > > > simControl.LastCall< > > > > > RequestResponseResponse>().Return(respRequest).IgnoreArguments(); > > > > > > This will always gives you errors in multi threaded env. You have to > > > > always > > > > > use LastCall.On and Exepct.On > > > > > > On Fri, Oct 3, 2008 at 5:19 PM, Raju <[EMAIL PROTECTED]> > > > > wrote: > > > > > > > Hi Ayende Rahien, > > > > > > > Thanks for the reply. I have tried with what you told. > > > > > > > mockService.RequestResponse(reqRequest); > > > > > > // > > > simControl.LastCall<RequestResponseResponse>().Return(respRequest).IgnoreArguments(); > > > > > > LastCall.On(mockService).Return(respRequest); > > > > > > > But this is also giving the same problem. > > > > > > > Can you give me, if possible, where to modify in the sent code. > > > > > > > I tried to create multiple threads in program.cs also. But nothing > > is > > > > > > working. > > > > > > > Regards, > > > > > > Nagaraju > > > > > > > On Oct 3, 10:12 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote: > > > > > > > Okay, now I understand what is going on. > > > > > > > Quite ingenious use of rhino mocks, btw. > > > > > > > > The problem is that you are calling LastCall. LastCall is using a > > > > static > > > > > > > variable that is records the last called mock. In multi threaded > > > > > > > environment, this is not safe to use. > > > > > > > There is another method, using Lastcall.On(mockObject) that > > should > > > > work > > > > > > > > On Thu, Oct 2, 2008 at 4:58 PM, Raju < > > [EMAIL PROTECTED]> > > > > > > wrote: > > > > > > > > > Hi Ayende Rahien, > > > > > > > > > I have created small application with multi threading. I have > > > > upload > > > > > > > > the files into Groups Files Section. > > > > > > > > The zip file name is To_RhinoMockGrp.zip. It will show uploaded > > by > > > > > > > > Raju. > > > > > > > > > Please check the UnitTest1.cs. In that TestMethod is having 2 > > > > threads. > > > > > > > > My goal is to run the TestMethod with multiple threads. > > > > > > > > > Regards, > > > > > > > > Nagaraju > > > > > > > > > On Oct 2, 3:28 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote: > > > > > > > > > Please create a test case that I can execute, so I can see > > what > > > > is > > > > > > going > > > > > > > > on. > > > > > > > > > > On Wed, Oct 1, 2008 at 10:59 PM, Raju < > > > > [EMAIL PROTECTED]> > > > > > > > > wrote: > > > > > > > > > > > Hi Ayende Rahien, > > > > > > > > > > > I have tried all the approaches I can, but still the > > following > > > > > > > > > > problems occured. > > > > > > > > > > > Invalid call, the last call has been used or no call has > > been > > > > made > > > > > > > > > > (make sure that you are calling a virtual (C#) / > > Overridable > > > > (VB) > > > > > > > > > > method). > > > > > > > > > > The result for the function has already been setup. > > > > > > > > > > Previous method requires a return value or an exception to > > > > throw. > > > > > > > > > > > These threads are working fine as individual but giving > > error > > > > if I > > > > > > run > > > > > > > > > > those threads simultaneously. > > > > > > > > > > > The biggest problem is here using Remoting and Multi > > Threading. > > > > > > > > > > > Is it possible to give me a small code for multi threading? > > > > > > > > > > > Thanks in advance and sorry the disturbance again. > > > > > > > > > > > Regards, > > > > > > > > > > Nagaraju > > > > > > > > > > > On Oct 1, 1:56 am, "Ayende Rahien" <[EMAIL PROTECTED]> > > wrote: > > > > > > > > > > > Yes, you can create multiple repositories in this > > scenario. > > > > > > > > > > > > On Tue, Sep 30, 2008 at 8:46 PM, Raju < > > > > > > [EMAIL PROTECTED]> > > > > > > > > > > wrote: > > > > > > > > > > > > > Hi Ayende Rahien, > > > > > > > > > > > > > Sorry for the disturbance again... Continution to my > > > > previous > > > > > > post, > > > > > > > > > > > > Here is what I am doing.... > > > > > > > > > > > > > My interface: > > > > > > > > > > > > public interface IControl > > > > > > > > > > > > { > > > > > > > > > > > > ServiceContractType > > > > > > > > > > > > CreateService<ServiceContractType>(); > > > > > > > > > > > > IMockRepositoryControl > > MockRepositoryControl > > > > > > {get; > > > > > > > > > > > > set;} > > > > > > > > > > > > Rhino.Mocks.Interfaces.IMethodOptions<T> > > > > > > > > > > > > LastCall<T>(); > > > > > > > > > > > > } > > > > > > > > > > > > My class: > > > > > > > > > > > > > internal class SimControl : MarshalByRefObject, > > ISimControl > > > > > > > > > > > > { > > > > > > > > > > > > private Dictionary<Type, object> > > > > _servicesMap = > > > > > > new > > > > > > > > > > > > Dictionary<Type, > > > > > > > > > > > > object>(); > > > > > > > > > > > > private static int counter = 10; > > > > > > > > > > > > > private IMockRepositoryControl[] > > > > _mockRepositoryControl > > > > > > = > > > > > > > > new > > > > > > > > > > > > IMockRepositoryControl[counter]; > > > > > > > > > > > > > public IMockRepositoryControl[] > > > > > > > > MockRepositoryControl > > > > > > > > > > > > { > > > > > > > > > > > > get { return > > _mockRepositoryControl; > > > > } > > > > > > > > > > > > set { _mockRepositoryControl = > > > > value; } > > > > > > > > > > > > } > > > > > > > > > > > > } > > > > > > > > > > > > > In launching my WCF services, program.cs file > > > > > > > > > > > > I am registering a tcp channel with > > BinaryServerFormatter > > > > and > > > > > > > > > > > > BinaryClientFormatter with one port. After that > > > > > > > > > > > > var mockRepo = new Rhino.Mocks.MockRepository(); > > > > > > > > > > > > var Control = new Control(); > > > > > > > > > > > > Control.MockRepositoryControl = new > > > > > > MockRepositoryControl[2]; > > > > > > > > > > > > Control.MockRepositoryControl[0] = new > > > > > > > > > > > > MockRepositoryControl(mockRepo); > > > > > > > > > > > > Control.MockRepositoryControl[1] = new > > > > > > > > > > > > MockRepositoryControl(mockRepo); > > > > > > > > > > > > //Control.MockRepositoryControl[1] = new > > > > > > > > > > > > MockRepositoryControl(mockRepo1); > > > > > > > > > > > > > So I am not modifying any Rhino Mocks code. This is > > what we > > > > got > > > > > > frm > > > > > > > > > > > > our client. Now we need to work for multi threading... > > You > > > > > > > > mentioned > > > > > > > > > > > > we need to create multiple repositories for the multi > > > > > > threading.. > > > > > > > > But > > > > > > > > > > > > is it fine to create multiple repositories as above in > > this > > > > > > case? > > > > > > > > > > > > > I use RemotingServices.Connect() to connect to the > > services > > > > > > created > > > > > > > > > > > > in > > > > > > > > > > > > program.cs. > > > > > > > > > > > > control = > > > > (IControl)Remoting.Connect(typeof(IControl),"tcp:// > > > > > > > > > > > > localhost: > > > > > > > > > > > > 8989/Control.rem"); > > > > > > > > > > > > > This "control" is used in multiple threads. The same > > > > "control" > > > > > > is > > > > > > > > used > > > > > > > > > > > > in both threads for record and playback. > > > > > > > > > > > > > control.MockRepositoryControl[0].ReplayAll(); // > > Example in > > > > > > TM1() > > > > > > > > > > > > control.MockRepositoryControl[0].VerifyAll(); // > > Example in > > > > > > TM1() > > > > > > > > > > > > > control.MockRepositoryControl[1].ReplayAll(); // > > Example in > > > > > > TM2() > > > > > > > > > > > > control.MockRepositoryControl[1].VerifyAll(); // > > Example in > > > > > > TM2() > > > > > > > > > > > > > But still I am getting error "Previous method requires > > a > > > > return > > > > > > > > value > > > > > > > > > > > > or an exception to throw." > > > > > > > > > > > > > I kept the MethodImpl[Synchronized] in Rhino > > interceptor. > > > > > > > > > > > > > So can you give me suggestion on this case. Thank you > > very > > > > much > > > > > > in > > > > > > > > > > > > advance. > > > > > > > > > > > > > I again searched the Rhino blocks using > > SetupResult.On() > > > > and > > > > > > > > > > > > Expect.Call(), but that was same error. > > > > > > > > > > > > > Regards, > > > > > > > > > > > > Nagaraju- Hide quoted text - > > > > > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > > > - Show quoted text -- > > ... > > read more »- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/RhinoMocks?hl=en -~----------~----~----~----~------~----~------~--~---