Mock without specifying ALL optional parameters?

3,495 views
Skip to first unread message

Phillip Haydon

unread,
Jun 10, 2015, 6:20:36 AM6/10/15
to moq...@googlegroups.com
How can I setup a mock and verify that the method was called when not all parameters are supplied?

Given:

Load<T>(object id, params Expression<Func<T, object>>[] includePath)

Where params makes it optional, I can't verify the call without specifying the 2nd argument. 

Zelalem

unread,
Jun 10, 2015, 3:55:36 PM6/10/15
to moq...@googlegroups.com
Phillip,
You can use It.IsAny<> to ignore supplying any specific parameter value or use lamda expression with it to create the mocked expression. 

--
--
Post: moq...@googlegroups.com
Unsubscribe: moqdisc-u...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "Moq Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moqdisc+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages