RajOpteamix / moq

Automatically exported from code.google.com/p/moq
Other
0 stars 0 forks source link

Feature request (with patch): It.IsIn(..), It.IsNotIn(...) #338

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I would like to request a Rhino Mocks feature be ported to Moq that allows 
parameter matching from a collection when setting up calls.

// IEnumerable<TValue>
mock.Setup(x => x.Echo(It.IsIn(Enumerable.Range(1, 5)))).Returns(1);

// Variadic params
mock.Setup(x => x.Echo(It.IsIn(1, 2, 3, 4, 5))).Returns(1);

// As well as the inverses
mock.Setup(x => x.Echo(It.IsNotIn(Enumerable.Range(1, 5)))).Returns(1);
mock.Setup(x => x.Echo(It.IsNotIn(1, 2, 3, 4, 5))).Returns(1);

At work I have done this by hand more times than I can remember so I figured I 
may as well submit a patch and make it official! A patch for this is attached 
(includes tests and documentation). Cheers, Rich

Original issue reported on code.google.com by rdingw...@gmail.com on 2 Apr 2012 at 7:36

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Rich!
Any chance you could fork moq4 over at github and send a pull request with this 
change?

Original comment by k...@clariusconsulting.net on 5 Sep 2012 at 6:56

GoogleCodeExporter commented 9 years ago
Done - https://github.com/Moq/moq4/pull/27

Original comment by rdingw...@gmail.com on 12 Sep 2012 at 9:40

GoogleCodeExporter commented 9 years ago
Merged!

Thanks! :-)

Original comment by dan...@cazzulino.com on 13 Sep 2012 at 1:41