ZiBaT => Peter
Levinsky => SWD => exercise |
Unit testing |
Updated : 2016-11-18
|
Idea : To implement and run your first unit test
Background:
Make a new console project
Make a folder named 'model'
Create a class 'person' in the model-folder (or in c# terms namespace)
this class must be public, have two properties Name and Age, have a constructor and the 'ToString' method
For the two properties you have these constraints
If these constraints are violated the class throws an ArgumentException.
In the same solution make a new project - choose TEST -> UnitTestProject.
Make a reference to your model class (i.e. add reference -> pick from solution your project).
Make appropriate testcases i.e. TestMethods to test the Person class (a round 8-9 testcases)
Have your exercise 21 programmed. Modify the BookCatalog class to be public.
In the same solution make a new project - choose TEST -> UnitTestProject.
Make a reference to your classes (i.e. add reference -> pick from solution your project).
Make an UnitTest for the class BookCatalog and test the three methods AddBook, LookupBook, PrintAllBooks.
Take the Simple-MVVM app.
In the same solution make a new project - choose Windows -> Universal -> Unit Test App (universal windows).
Make a reference to your classe (i.e. add reference -> pick from solution your app project).
Make an UnitTest for your viewmodel class (e.g. 'MainViewModel') and test the methods and properties (e.g. concentrate at the method(s) for the command)