I am wishing to teach myself how to effectively test using VS2010 and C# for an upcoming interview. Any resources on learning this would be greatly appreciated (especially a quick and dirty "here is how you create a test project/run it/make assertions" document - I just need to get my hands dirty!). :)
What I am trying to learn with is a small project which I have written. I have a few comboboxes with criteria/keywords which queries certain columns in a table to see if the right values are returned. So, for instance, I have a column "Colour"
and a corresponding combo box in my WPF application for "Colour"
. When "Red"
is selected, I want to return all the cols with the "Red"
value in its row etc. etc.
I've randomised my db data and want to create some assertions now (eg for "Red" combobox value, "Red" rows only are returned).
What is the most effective and best way I can test an application of this nature?
Theoretically, I know it's about creating some test data, feeding "Red"
into the search function and asserting that only "Red"
columns are returned. However, practically, how do I do this with VS2010 and C#? Resources for this are, surprisingly, hard to come by.
Do I open the project, add a new test project, create a standalone project, where do I go from there...? A simple beginners intro to adding a test project and some guidelines for the best ways to make assertions would really help me out.
Thanks very much.
Please have a look a the MVVM-Pattern, that allows you to create modular and testable WPF-applications. In the referenced Wikipedia article you will find lots of resources for further reading.
If you want a UI testing framework for WPF, see How to test a WPF user interface?.
If you want to test your underlying logic, create a class structure that represents your UI (commonly called a View Model), move it to a separate class library assembly (DLL) and test it using testing library like MS Test or NUnit. Reference the view model from the application.
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