Please find below a quick example I just put together.

It is of course entirely possible that I am wrongly interpreting the
passing of the second test.


namespace Example
{
    public interface ITestItem { ITestChild Child { get; set; } }

    public class TestItem : ITestItem
    {

        public TestItem(ITestChild child)
        {
            Child = child;
            Child.SetParent(this);
        }

        public ITestChild Child { get; set; }
    }

    public interface ITestChild
    {
        ITestItem Parent { get; }
        void SetParent(ITestItem item);
    }

    public class TestChild : ITestChild
    {
        public void SetParent(ITestItem item) { Parent = item; }
        public ITestItem Parent { get; private set; }
    }

    [TestFixture]
    public class TestItemFixture
    {
        [Test]
        public void WhenUsingAStub_ShouldPassAssertionTest()
        {
            var child = MockRepository.GenerateStub<ITestChild>();

            var item = new TestItem(child);
            var actual = item.Child;


            Assert.That(actual, Is.EqualTo(child));
        }

        [Test]
        public void WhenUsingExpect_ShouldPassVerifyAllExpectations()
        {
            var child = MockRepository.GenerateStub<ITestChild>();
            child.Expect(c => c.SetParent
(Arg<ITestItem>.Is.Anything));

            new TestItem(child);

            child.VerifyAllExpectations();
        }
    }
}

--

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