I mock and provide an expectation on a service class. Then I call the
mock from another thread within a Func.
This causes rhinomock to throw a null reference exception. How can I
work around this?

// test case

 _service = MockRepository.GenerateMock<IService>();
 _service.Expect(s =>
s.GetAllQuotes()).Return(quoteCollection);

// in the class i'm testing

            Func<IService, QuoteCollection> loadAction = (service) =>
            {
                try
                {
                    QuoteCollection quoteCollection =
service.GetAllQuotes();
                    return quoteCollection;
                }
                catch (Exception ex)
                {
                    // null exception here at
Rhino.Mocks.ArgManager.get_HasBeenUsed()
                }

                return null;
            };

            loadAction.BeginInvoke(_service, LoadQuotesCompleted,
loadAction);

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