---------------------------------------------------------------------- Lecture 2 -- Test-Driven Scenario - Create a new change set "Money" - Define TestMoney subclass of TestCase in category Money ivars chf2 chf8 chf10 - Add some class comments - Define setUp: chf2 := Money new currency: 'CHF'; amount: 2. etc - Let Browser create new class Money. - Put setUp into a protocol (e.g., "initialize") - Define tests: MoneyTest>>testEquals self assert: chf2 = chf2. self assert: chf2 = (Money new currency: 'CHF'; amount: 2). self assert: chf2 != chf8. - Put into protocol (e.g., "tests") - Define Money ivars currency and amount with accessors - Try to run the tests TestRunner open - Define Money>>= and proceed - Define Money!= and proceed - Rewrite setUp to use Money class>>currency:amount: - Define: MoneyTest>>testAdd self assert: chf2 + chf8 = chf10 - Define Money>>+ and run the tests - File out changes and examine - Rewrite: MoneyTest>>setUp chf2 := 2 chf. chf8 := 8 chf. chf10 := 10 chf. - Define protocol *Money in Number Number>>chf ^ Money currency: 'CHF' amount: self - run tests. - File out and re-examine. ----------------------------------------------------------------------