Setting a property expectation using the new "Property Setters
Explicit Expectation API" doesn't work as I expected using the AAA
syntax. I'm getting an InvalidOperationException when I try to set the
property expectation. With the old Record-Playback syntax it works
just fine. It seams the MockRepository.LastMockedObject isn't set,
setting properties expectations with the mock object in replay mode. I
wrote the following tests in the trunk to see if I run into the same
problem. As expected the first test passes and the second one fails.
namespace Rhino.Mocks.Tests.FieldsProblem
{
using MbUnit.Framework;
[TestFixture]
public class FieldProblem_Eduardo
{
[Test]
public void
CanSetExpectationOnReadWritePropertyUsingRecordPlaybackSyntax()
{
var mocks = new MockRepository();
var demo = mocks.DynamicMock<IDemo>();
using (mocks.Record())
{
demo.Expect(x =>
x.Prop).SetPropertyWithArgument("Eduardo");
}
using (mocks.Playback())
{
demo.Prop = "Eduardo";
}
}
[Test]
public void
CanSetExpectationOnReadWritePropertyUsingAAASyntax()
{
var demo = MockRepository.GenerateMock<IDemo>();
demo.Expect(x =>
x.Prop).SetPropertyWithArgument("Eduardo");
demo.Prop = "Eduardo";
demo.VerifyAllExpectations();
}
}
}
I'm using RhinoMocks v3.5 RTM and .Net Framework 3.5 SP1.
Am I doing something wrong?
Eduardo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---