A nifty Typemock extension

Using AAA with Typemock there’s a bit of a problem if you want to repeat the returned value a number of times before then doing something different. It’s very useful if you are accessing a mocked object within a loop and want to know the number of loop…


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail

Using AAA with Typemock there's a bit of a problem if you want to repeat the returned value a number of times before then doing something different. It's very useful if you are accessing a mocked object within a loop and want to know the number of loop execution. So I've put together a simple little Typemock extension (but I'm sure it'd adaptable for any mock framework supporting AAA): public static void WillReturnRepeat<TReturn>(this IPublicNonVoidMethodHandler ret, TReturn value, int numberOfReturns) { for (var i = 0; i < numberOfReturns; i++) ret.


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail


Print Share Comment Cite Upload Translate
APA
Posts on LINQ to Fail | Sciencx (2023-02-04T22:58:52+00:00) » A nifty Typemock extension. Retrieved from https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/.
MLA
" » A nifty Typemock extension." Posts on LINQ to Fail | Sciencx - Tuesday March 3, 2009, https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/
HARVARD
Posts on LINQ to Fail | Sciencx Tuesday March 3, 2009 » A nifty Typemock extension., viewed 2023-02-04T22:58:52+00:00,<https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » A nifty Typemock extension. [Internet]. [Accessed 2023-02-04T22:58:52+00:00]. Available from: https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/
CHICAGO
" » A nifty Typemock extension." Posts on LINQ to Fail | Sciencx - Accessed 2023-02-04T22:58:52+00:00. https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/
IEEE
" » A nifty Typemock extension." Posts on LINQ to Fail | Sciencx [Online]. Available: https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/. [Accessed: 2023-02-04T22:58:52+00:00]
rf:citation
» A nifty Typemock extension | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/ | 2023-02-04T22:58:52+00:00
https://github.com/addpipe/simple-recorderjs-demo