The Test method is not virtual, so RhinoMocks cannot override it to do nothing.
On Tue, Jan 5, 2010 at 12:40 AM, Wigman <[email protected]> wrote: > When stubbing a class i expect the original class code is not > executed. However, the following example does throw an exception("We > don't expect this to be thrown"). I thought stubs never failed a test. > What am I doing wrong here? How can i make Rhino stub the existing > class properly, so calling Test() does not give errors? > > using System; > using NUnit.Framework; > using Rhino.Mocks; > > namespace Roxit.Link.Test > { > [TestFixture] > public class RhinoTest > { > [Test] > public void TestStub() > { > Onzin onzin = MockRepository.GenerateStub<Onzin>(); > onzin.Test(); > > } > > public class Onzin > { > public void Test() > { > throw new Exception("We don't expect this to be > thrown"); > } > } > } > } > > -- > > 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]<rhinomocks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rhinomocks?hl=en. > > > -- Jono -- 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.
