Hm, using the trunk, it all works.I committed a passing test

On Wed, Dec 3, 2008 at 12:26 AM, Nolan Egly <[EMAIL PROTECTED]> wrote:

>
> While writing tests tonight I ran into a surprise of some tests that
> didn't go green after I added the implementation.  Stepping through
> the debugger yielded some unexpected (to me at least) return values
> from the properties of a mock stub.
>
> Here's a quick set of tests that illustrate the behavior.  The test
> fixture
>
> "When_mocking_properties_with_RhinoMocks_stub_and_setting_expectations_afterward"
> fails the tests
> "Should_mock_value_int_property", "Should_mock_value_date_property",
> and "Should_mock_nullable_value_date_property".
>
> No patch given because
>  1) I'm not sure if the adding of the expectation afterward is
> failing to remove all of the reference property expectations or
> unintentionally removing existing value type property expectations
>  2) I'm insanely busy right now :)
>
>
>        public interface IDemo
>        {
>                int SomeInt { get; set; }
>                DateTime SomeDate { get; set; }
>                DateTime? SomeNullableDate { get; set; }
>                DateTime? SomeNulledDate { get; set; }
>                object SomeObject { get; set; }
>
>                bool TimeToGoHome();
>        }
>
>        [TestFixture]
>        public class When_mocking_properties_with_RhinoMocks_stub
>        {
>                protected IDemo _demo;
>                protected int _newInt = 7;
>                protected DateTime _newDate = new DateTime(2008, 12, 2, 22,
> 17, 0);
>                protected DateTime? _newNullableDate = new DateTime(2008,
> 12, 2, 22,
> 17, 0);
>                protected DateTime? _newNulledDate = null;
>                protected Object _newObject = new object();
>
>                protected void SetValuesOnMock()
>                {
>                        _demo.SomeInt = _newInt;
>                        _demo.SomeDate = _newDate;
>                        _demo.SomeNullableDate = _newNullableDate;
>                        _demo.SomeNulledDate = _newNulledDate;
>                        _demo.SomeObject = _newObject;
>                }
>
>                [SetUp]
>                public virtual void SetUp()
>                {
>                         _demo = MockRepository.GenerateStub<IDemo>();
>                        SetValuesOnMock();
>                }
>
>                [Test]
>                public void Should_mock_value_int_property()
>                {
>                        Assert.AreEqual(_newInt, _demo.SomeInt);
>                }
>
>                [Test]
>                public void Should_mock_value_date_property()
>                {
>                        Assert.AreEqual(_newDate, _demo.SomeDate);
>                }
>
>                [Test]
>                public void Should_mock_nullable_value_date_property()
>                {
>                        Assert.AreEqual(_newNullableDate,
> _demo.SomeNullableDate);
>                }
>
>                [Test]
>                public void Should_mock_nulled_value_date_property()
>                {
>                        Assert.AreEqual(_newNulledDate,
> _demo.SomeNulledDate);
>                }
>
>                [Test]
>                public void Should_mock_reference_property()
>                {
>                        Assert.AreEqual(_newObject, _demo.SomeObject);
>                }
>        }
>
>        [TestFixture]
>        public class
> When_mocking_properties_with_RhinoMocks_stub_and_setting_expectations_afterward
> :
> When_mocking_properties_with_RhinoMocks_stub
>        {
>                [SetUp]
>                public override void SetUp()
>                {
>                        _demo = MockRepository.GenerateStub<IDemo>();
>                        SetValuesOnMock();
>
>                        _demo.Expect(d => d.TimeToGoHome())
>                                .Repeat.Any()
>                                .Return(false);
>                }
>        }
>
>        [TestFixture]
>        public class
> When_mocking_properties_with_RhinoMocks_stub_and_setting_expectations_beforehand
> :
> When_mocking_properties_with_RhinoMocks_stub
>        {
>                [SetUp]
>                public override void SetUp()
>                {
>                        _demo = MockRepository.GenerateStub<IDemo>();
>
>                        _demo.Expect(d => d.TimeToGoHome())
>                                .Repeat.Any()
>                                .Return(false);
>
>                        SetValuesOnMock();
>                }
>        }
> >
>

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