I am a student on a work placement. I have been given the task of finishing an app, then testing.
The app is done, and I have tested 80 %. However, I have some methods that are not directly testable as they use session vars and form requests. I understand that I need to use a mocking framework, and chose to go with moq, as from what I have read it is awesome. Unfortunately, I've played around with it and find it a bit over my head (I'm new to C# in general, including lambdas, etc.)
I haven't been able to find a simplified beginners walkthrough. Any ideas where I could find such a thing? As I said, all I need is to be able to mock session and forms. All attempts thus far have consisted of me (in a futile manner) plugging in random code found here on SO, and hoping for the best.
I would much rather understand it so I can truly work with it....
Thanks!
I've found these tutorials which go over the basics. I don't think there would be anything covering basic C# concepts alongside the Moq framework. If you are getting stuck on things like lambdas it shouldn't be too hard to find a beginners tutorial. I've added a couple of links for lambda tutorials below.
You might also want to try making some simple prototypes of what you want to do before attempting a full solution for the main application. This will let you play around with the concepts without having to worry about the details of the application.
http://code.google.com/p/moq/wiki/QuickStart
http://andrewblogs.com/blog/moq-testing-tutorial/
http://blogs.msdn.com/b/ericwhite/archive/2006/10/03/lambda-expressions.aspx
http://www.switchonthecode.com/tutorials/csharp-tutorial-the-lambda-operator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With