Hi,

I just tried to update my code to start using Rhino 3.5. I have the
test something like:

 [TestFixture]
    public class RihoMock35Problem
    {
        private MockRepository _mockRepo;
        private Exception _lastException;

        [Test]
        public void RhinoMock35ProblemTest()
        {
            _mockRepo = new MockRepository();
            CreateMock();

            _lastException = null;

            Thread t = new Thread(CreateMock);
            t.Start();
            t.Join();
            Assert.IsNull(_lastException);
        }

        public void CreateMock()
        {
            try
            {
                IList<int> list = _mockRepo.DynamicMock<IList<int>>();
                _mockRepo.BackToRecordAll();
                Assert.IsNotNull(list);
                Expect.Call(list.Count).Return(5);
                _mockRepo.ReplayAll();
                Assert.AreEqual(5, list.Count);

                Expect.Call(list.Count).Return(50);
                Assert.AreEqual(50, list.Count);
            }
            catch (Exception e)
            {

                _lastException = e;
            }
        }
    }

But the Above test is failing with the error:
RhinoProblem.RihoMock35Problem.RhinoMock35ProblemTest:
  Expected: null
  But was:  <System.NullReferenceException: Object reference not set
to an instance of an object.
   at Rhino.Mocks.ArgManager.get_HasBeenUsed()
   at Rhino.Mocks.Impl.RecordMockState.MethodCall(IInvocation
invocation, MethodInfo method, Object[] args)
   at Rhino.Mocks.MockRepository.MethodCall(IInvocation invocation,
Object proxy, MethodInfo method, Object[] args)
   at Rhino.Mocks.Impl.RhinoInterceptor.Intercept(IInvocation
invocation)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at IList`1Proxy3691c7ca3b654c2c9bc74c269aea39dd.get_Count()
   at RhinoProblem.RihoMock35Problem.CreateMock() in C:\Data\DEVEL
\TestingCode\RhinoProblem\RhinoProblem\Class1.cs:line 38>


The problem is coming when I call the CreateMock method above from
different thread.

Any help please?

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