I believe this is a problem with MSTest. The code as it sits below works for me in both NUnit and MbUnit.
I don't use MSTest (to intrusive as this example demonstrates) so I cannot confirm but at this point this is the only difference I can see. Sorry, but you need to upgrade your testing platform On Thu, Sep 3, 2009 at 11:24 AM, Taylor906 <[email protected]> wrote: > > I'm using VS2K8 Pro/.NET 3.5/MSTest, and I'm trying to get the > examples on the following Wiki page to work: > > http://ayende.com/wiki/Rhino+Mocks+Mocking+classes.ashx > > In particular, this example: > > [TestMethod] > public void AbuseArrayList_UsingCreateMockGenerics() > { > Rhino.Mocks.MockRepository mocks = new > Rhino.Mocks.MockRepository(); > System.Collections.ArrayList list = > mocks.CreateMock<System.Collections.ArrayList>(); > > // Setup the expectation of a call on the mock > Rhino.Mocks.Expect.Call(list.Capacity).Return(999); > mocks.ReplayAll(); > > // Evaluate the values from the mock > Assert.AreEqual(999, list.Capacity); > mocks.VerifyAll(); > } > > The test throws the following exception when setting the expectation > on the Capacity property: > > Failed AbuseArrayList_UsingCreateMockGenerics TestProject1 Test method > TestProject1.Class1Test.AbuseArrayList_UsingCreateMockGenerics threw > exception: System.InvalidOperationException: Previous method > 'ArrayList.get_Count();' requires a return value or an exception to > throw.. > > Is there something obvious that I'm missing? If not, do any of the > examples on this page actually work? > > I can mock virtual methods of concrete classes with no problems; I am > only having problems with virtual properties of concrete classes, and/ > or the examples on the Wiki. > > > > -- Tim Barcz Microsoft ASPInsider http://timbarcz.devlicio.us http://www.twitter.com/timbarcz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
