11/16/2010 3:23:11 PM
 Ludovic Dubois Administrator Posts: 159
|
In this video (13:30), you will learn to write tests with relative assertions:
- Absolute Assertions
runtest with hard-coded values: runtest item.Quantity = 2; Assertions with hard-coded values: assert item.Quantity == 2;
- Relative Assertions to test changes
runtest with relative values: runtest item.Quantity++; Assertions with relative values: assert changed item.Quantity++;
- Relative Assertions to test non-changes
Assertions with !changed: assert !changed item.UnitPrice;
- Global Relative Assertions
Assertions with * for properties (-* for fields): assert !changed item.*; Assertions with exceptions: assert !changed item.* except Quantity, Price;
- Combined Assertions
Assertions with relative assertion exceptions: assert !changed item.* except change Quantity++, change Price += product.Price;
- Combined absolute Assertions
Assertions with absolute assertion exceptions: assert !changed item.* except Quantity == 2, Price == 2 * product.Price;
Think the rule, code the rule... not the result of the rule once applied for hard-coded values. 
Access source code from our svn server at: https://www.prettyobjects.com:7567/svn/public/TSharp/Samples/Products/?p=21
edited by Ludovic Dubois on 16/11/2010 <em>edited by Ludovic Dubois on 13/12/2010</em>
|
|
|
0
• permalink
|