Hi,

I am trying to do something I thought would be common but can't find
anywhere.
I'll include full code below.

I want to have a Mocked object and make sure it calls a function, fine
so far.
The function takes an argument and I want to make sure the argument
has changed from what I passed in.
It will still be the same object but it's properties have changed.

So I am mocking a function that takes a List<int> as an argument, and
I don't want the test to be "is this the same object" I want it to be
"is the Count on the object equal to 1".

Is this possible?

Hopefully the code will explain this better.

  Thanks, Vin

namespace TestingMocks
{
    [TestClass]
    public class TestingMock
    {
        [TestMethod]
        public void TestMe()
        {
            MockRepository mocks = new MockRepository();

            List<int> list = new List<int>();

            Dummy dummy = mocks.DynamicMock<Dummy>();
            using (mocks.Ordered())
            {
                dummy.Save(list);
                Testing.dummy = dummy;
            }
            mocks.ReplayAll();

            Testing.Incrementer(list);

            mocks.VerifyAll();
        }
    }

    public class Testing
    {
        public static Dummy dummy { get; set; }

        public static void Incrementer(List<int> list)
        {
            list.Add(1);
            dummy.Save(list);
        }
    }

    public class Dummy
    {
        public virtual void Save(List<int> list)
        {
        }
    }
}

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