It's it not that the stub is causing your test to fail ... It is that  
the stub can't quite do its job until some prerequisites are met...the  
one here that you are running into is that stubbed methods need to be  
virtual ( this is so that dynamic proxy can proxy the method )

Tim

On Jan 5, 2010, at 1:39 AM, Wigman <[email protected]> wrote:

> Well, excuse me, Bill. The Rhino documentation clearly states that
> generating a stub will never fail a test. Well, it does! And there ARE
> mock products that can actually create a thorough stub, stubbing all
> methods of an existing class, virtual or not, so excuse me again for
> my learning curve using Rhino. Saying test-driven developing means you
> always create interface/virtuals for every class used in a test is new
> for me too... and I sure hope you're wrong about it.
>
> On Jan 4, 11:06 pm, bill richards <[email protected]>
> wrote:
>> and just to add to these perfectly explanatory responses .... this i
>> the result of NOT developing your code in a test driven manner
>>
>> On Jan 4, 8:48 pm, Tim Barcz <[email protected]> wrote:
>>
>>
>>
>>> I'll be honest in that I don't run into this problem very often  
>>> because I
>>> almost always try to have an interface in there...and as Caio  
>>> pointed out,
>>> it's not a problem that shows up when programming interfaces.
>>
>>> Tim
>>
>>> On Mon, Jan 4, 2010 at 1:53 PM, Caio Kinzel Filho  
>>> <[email protected]> wrote:
>>
>>>> I think most of the time, when you are programming against  
>>>> interfaces
>>>> rather than against implementations, you will not have that  
>>>> problem,
>>>> once rhino.mocks can just implement that interface instead of
>>>> inheriting from your implementation
>>
>>>> On Mon, Jan 4, 2010 at 5:49 PM, Wigman <[email protected]>  
>>>> wrote:
>>>>> Ok, now I know, thanx a million! Too bad i have to adjust the
>>>>> 'visibility' of my methods just to get the testing part in order.
>>
>>>>> On Jan 4, 4:02 pm, Jonathon Rossi <[email protected]> wrote:
>>>>>> 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 
>>>>>>> %2bunsubscr...@googlegrou ps.com>
>>>> <rhinomocks%2bunsubscr...@googlegrou ps.com>
>>>>>>> .
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/rhinomocks?hl=en.
>>
>>>>>> --
>>>>>> Jono- Hide quoted text -
>>
>>>>>> - Show quoted text -
>>
>>>>> --
>>
>>>>> 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 
>>>> %2bunsubscr...@googlegrou ps.com>
>>>> .
>>>>> For more options, visit this group at
>>>> http://groups.google.com/group/rhinomocks?hl=en.
>>
>>>> --
>>
>>>> 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 
>>>> %2bunsubscr...@googlegrou ps.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/rhinomocks?hl=en.
>>
>>> --
>>> Tim Barcz
>>> Microsoft C# MVP
>>> Microsoft ASPInsiderhttp://timbarcz.devlicio.ushttp:// 
>>> www.twitter.com/timbarcz-Hide quoted text -
>>
>>> - Show quoted text -- Hide quoted text -
>>
>> - Show quoted text -
>
> --
>
> 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 
> .
>
>

--

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