Rhino.Mocks 3.6.0.0.

On the off-chance that MSTest has anything to do with it, I created a
new WinForms application that references Rhino.Mocks.  No MSTest
reference is used, no references to other unit test frameworks are
used.  Pasted the test method below into the application; minus the
[TestMethod] attribute and Assert call.  The code looks like this:

        [STAThread]
        static void Main()
        {
            AbuseArrayList_UsingCreateMockGenerics();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        static void AbuseArrayList_UsingCreateMockGenerics()
        {
            MockRepository mocks = new MockRepository();
            ArrayList list = mocks.CreateMock<ArrayList>();

            // Setup the expectation of a call on the mock
            Expect.Call(list.Capacity).Return(999);
            mocks.ReplayAll();

            // Evaluate the values from the mock
            int n = list.Capacity;
            mocks.VerifyAll(); ;
        }

The same exception is thrown at Expect.Call(list.Capacity).  So, this
is not a problem with MSTest.  I'll try downgrading to an earlier
version of Rhino.Mocks to see what happens.

On Sep 5, 10:24 am, Shawn Neal <[email protected]> wrote:
> I just tried the same test using MSTest and it works fine.  I used the
> ReSharper test runner as well as the one built into VS 2008, both passed.
>  I'm using Rhino Mocks 3.5.0.1337, which version of RhinoMocks are you
> using?
>
> On Fri, Sep 4, 2009 at 6:13 PM, Tim Barcz <[email protected]> wrote:
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to