So my stub.AssertWasCalled... is valid?

On Fri, Nov 7, 2008 at 8:08 AM, Ayende Rahien <[EMAIL PROTECTED]> wrote:

> Because there isn't really much of a difference between the two, and I got
> feature request to be able to assert of stub calls.
>
>
> On Fri, Nov 7, 2008 at 4:03 PM, Shane Courtrille <
> [EMAIL PROTECTED]> wrote:
>
>> Which to me is the standard difference between the two.
>>
>> The question is why does the interface for a stub have to support
>> operations which are the domain of a mock object?  When a new comer looks at
>> a Stub shouldn't they be able to tell the difference without having to deal
>> with the mental baggage of "Hey wait.. a stub looks a lot like a mock to
>> me".
>>
>> Shane
>>
>>
>> On Fri, Nov 7, 2008 at 6:15 AM, Ayende Rahien <[EMAIL PROTECTED]> wrote:
>>
>>> The main thing is a concpetual difference.I would use stub if I don't
>>> care about what is going to happen
>>> I would use a mock if I do care.
>>>
>>>
>>> On Fri, Nov 7, 2008 at 2:05 PM, Tim Barcz <[EMAIL PROTECTED]> wrote:
>>>
>>>> I am working on a presentation and was about to make the assertion,
>>>> "stubs can't have expectations set on them".  I decide to double check
>>>> myself and run the following code and see that I can set expectations.
>>>> (Removing the call to logger.Log in the Order method causes the test to
>>>> fail).
>>>>
>>>> [TestFixture]
>>>> public class Stubs
>>>> {
>>>>     [Test]
>>>>     public void CreateStub()
>>>>     {
>>>>         var logger = MockRepository.GenerateStub<ILogger>();
>>>>
>>>>         var svc = new OrderService(logger);
>>>>
>>>>         svc.Order();
>>>>
>>>>         logger.AssertWasCalled(x=>x.Log("hello"));
>>>>     }
>>>>
>>>>     public class OrderService
>>>>     {
>>>>         private readonly ILogger logger;
>>>>
>>>>         public OrderService(ILogger logger)
>>>>         {
>>>>             this.logger = logger;
>>>>         }
>>>>
>>>>         public void Order()
>>>>         {
>>>>             logger.Log("hello");
>>>>         }
>>>>     }
>>>> }
>>>>
>>>> public interface ILogger
>>>> {
>>>>     void Log(string message);
>>>> }
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

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