Hopefully today is a more fruitful posting day. Can anyone see why
this test fails?

If i stub a method to return different values based on incoming
parameters and then the calls happen in a different order to the
stubbing order it fails. (inheritance is involved and i beleive the
problem)

Heres the test

using System;
using NUnit.Framework;
using Rhino.Mocks;

namespace RhinoBug
{
    [TestFixture]
    public class RhinoBugMaybe
    {
        [Test]
        public void Bug()
        {
            IService service = MockRepository.GenerateStub<IService>
();

            service.Stub(x => x.Send(Arg<Message2>.Matches(msg =>
msg.Value == 2))).Return(2);
            service.Stub(x => x.Send(Arg<Message1>.Is.TypeOf)).Return
(1);

            Assert.AreEqual(1, service.Send(new Message1()));
            Assert.AreEqual(2, service.Send(new Message2(2)));

        }

    }

    public class Message2 : MessageBase
    {
        public Message2(int value)
        {
            Value = value;
        }

        public int Value { get; set; }
    }

    public class Message1 : MessageBase
    {
    }

    public interface IService
    {
        int Send(MessageBase msg);
    }

    public class MessageBase
    {
    }
}


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