1- using NUnit . Framework ;
2- using TheSoftwareGorilla . TDD . Money ;
3-
41namespace TheSoftwareGorilla . TDD . Money . Tests ;
52
63public class MoneyTests
74{
5+ //TODO: $5 + 10 CHF = $10 if rate is 2:1
6+ //TODO: $5 * 2 = $10 - DONE
7+ //TODO: Make "amount" private - DONE
8+ //TODO: Dollar side-effects? - DONE
9+ //TODO: Money rounding?
10+ //TODO: equals() -DONE
11+ //TODO: hashCode()
12+ //TODO: Equal null
13+ //TODO: Equal object
14+ //TODO: 5 CHF * 2 = 10 CHF - DONE
15+ //TODO: Dollar/Franc duplication
16+ //TODO: Common equals - DONE
17+ //TODO: Common Times
18+ //TODO: Compare Francs with Dollars - DONE
19+ //TODO: Currency?
20+
821 [ SetUp ]
922 public void Setup ( )
1023 {
24+ // No setup required for these tests
1125 }
1226
1327 [ Test ]
1428 public void TestEquality ( )
1529 {
16- Assert . That ( new Dollar ( 5 ) , Is . EqualTo ( new Dollar ( 5 ) ) ) ;
17- Assert . That ( new Dollar ( 6 ) , Is . Not . EqualTo ( new Dollar ( 5 ) ) ) ;
18- Assert . That ( new Franc ( 5 ) , Is . EqualTo ( new Franc ( 5 ) ) ) ;
19- Assert . That ( new Franc ( 6 ) , Is . Not . EqualTo ( new Franc ( 5 ) ) ) ;
20-
30+ Dollar fived = new Dollar ( 5 ) ;
31+ Dollar sixd = new Dollar ( 6 ) ;
32+ Franc fivef = new Franc ( 5 ) ;
33+ Franc sixf = new Franc ( 6 ) ;
34+
35+ Assert . That ( fived , Is . EqualTo ( new Dollar ( 5 ) ) ) ;
36+ Assert . That ( sixd , Is . Not . EqualTo ( new Dollar ( 5 ) ) ) ;
37+ Assert . That ( fivef , Is . EqualTo ( new Franc ( 5 ) ) ) ;
38+ Assert . That ( sixf , Is . Not . EqualTo ( new Franc ( 5 ) ) ) ;
39+
2140 // In NUnit, the following line will not compile because .EqualTo type-checks its argument.
22- // I'm commenting the line out to avoid compilation errors, and I added Assert.False below to
41+ // I'm commenting the line out to avoid compilation errors, and I added Assert(Is .False) below to
2342 // be more consistent with the book.
2443 // Assert.That(new Franc(5), Is.Not.EqualTo(new Dollar(5)));
25- Assert . False ( new Franc ( 5 ) . Equals ( new Dollar ( 5 ) ) ) ;
44+ Assert . That ( new Franc ( 5 ) . Equals ( new Dollar ( 5 ) ) , Is . False ) ;
45+
2646 }
2747
2848}
0 commit comments