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 Updates
APA

Posts on LINQ to Fail | Sciencx (2009-03-03T22:49:47+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 ,<https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » A nifty Typemock extension. [Internet]. [Accessed ]. 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 . 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: ]
rf:citation
» A nifty Typemock extension | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2009/03/03/a-nifty-typemock-extension/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.