You can do the following:
Expect.Call(() => m_Service.UpdateTrade(
Arg<Trade>.Matches(t => t.Delivery.Equals(new DateTime(2013, 7, 3))),
Arg<Token>.Is.Anything)
);
Please also note, if you are not going to validate token
parameter in this tests, then you can use Is.Anything
constraint for it.
Note:
RhinoMocks 3.5 and .NET4+ throw an AmbiguousMatchException when using the Matches(Expression<Predicate<..>>)
overload. If it is not possible to update to RhinoMocks 3.6 (there are reasons), one can still use the Matches(AbstractConstraint)
overload as so:
Arg<Trade>.Matches(
Property.Value("Delivery", new DateTime(2013, 7, 3)))
or:
Arg<Trade>.Matches(
new PredicateConstraint<DateTime>(
t => t.Delivery.Equals(new DateTime(2013, 7, 3))))