Try using a Stub instead of a mock.

---
Patrick Steele
http://weblogs.asp.net/psteele



On Tue, Dec 28, 2010 at 1:04 PM, Chris May <[email protected]> wrote:
> I haven't worked with Rhino mocks in a bit, and it seems I can't get
> PropertyBehavior to work correctly, or maybe it's changed (or maybe
> I'm just totally remembering wrong).
>
> When I run this simple code:
>
>    Public Interface ITest
>        Property X As Integer
>        Property y As Integer
>    End Interface
>
>    Public Sub TestStuff()
>        mocks = New MockRepository
>        Dim v As ITest = mocks.DynamicMock(Of ITest)()
>
>        SetupResult.For(v.X).PropertyBehavior()
>
>        Assert.IsTrue(v.X = 0)
>    End Sub
>
> I get an exception on the Assert line saying:
> Can't return a value for property X because no value was set and the
> Property return a value type.
>
> Now, I CAN just set v.X = 0 before I try to read it, but I don't think
> I've ever had to do this before, and I have some very large interfaces
> where I'd rather not set every property equal to a null value when
> setting those values isn't needed (e.g. Integers are already 0).
>
> Am I doing something wrong?  Has something changed?
>
> --
> 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.
>
>

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