As far as I'm aware this functionality does not exist out of the box, but as
I understand it you can define your own constraints, so maybe you can derive
from AllPropertiesMatch constraint to do this, or from AbstractConstraint.

You can also submit it as a request to the Rhino Mocks 4.0 planning:
http://nhprof.uservoice.com/pages/28152-rhino-mocks-4-0

2009/12/1 dhearing1 <[email protected]>

> Thanks for your reply Alex.
>
> However, the problem I have is that I have an object which has more
> than one property and some of the properties are doubles.  This is why
> I'd like to use the AllPropertiesMatch constraint.  I could just write
> a customised checking routine, but that's not so nice, as currently I
> can use the AllPropertiesMatch for *any* object which means it's easy
> to write very generic tests.
>
> If there were some way of specifying a delta for the
> AllPropertiesMatch constraint to use if it came across a floating
> point property that would be really helpful.  I don't know if there's
> already some way to do this, or if not whether it could be added into
> the next version of RhinoMocks?
>
> Dominic
>
>
> On Dec 1, 8:07 pm, Alex McMahon <[email protected]> wrote:
> > The way I've normally done this sort of thing is with the
> arg<T>.matches():
> >
> > Arg<double>.Matches(p=>Math.Round(p,2)==testVal)
> >
> > 2009/12/1 dhearing1 <[email protected]>
> >
> > > Hi,
> >
> > > I'm using the AllPropertiesMatch constraint, but some of the objects I
> > > am testing have Double properties, and I would like to supply a delta
> > > so that the expected and actual values can be different as long their
> > > difference is less than delta.  This allows for rounding errors.
> >
> > > Is there any way to do this?
> >
> > > Thanks,
> >
> > > Dominic
> >
> > > --
> >
> > > 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]<rhinomocks%[email protected]>
> <rhinomocks%[email protected]<rhinomocks%[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]<rhinomocks%[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