Saturday, May 26, 2007

tests

New Effect
 Ok, I'm going to try to create all the intermediate tests this time. My goal is to eventually test showing the stage manager my ukulele and having the stage manager take the ukulele away. I'll start with a new effect that removes an item from the character.

testTakeItemEffect
 I'm going along pretty well, but I've found two refactorings that I'd like to do. While neither of them are worth getting distracted for, I'll list them here and do them next. Along the way, I've also implemented objCharacter.RemoveItem().
 Hmm... Not working yet. I'll need to make the DebugPrint method on objCharacter aware of the items the character has, to help show what's going wrong.
 Ah, I didn't do my tests incrementally enough. I simplify this test to call objCharacter.RemoveItem(...) directly. That works. So that narrows it down significantly. Ok, this test (like most tests, really) is worth keeping. I'll rename it to "testTakeUkeleleFromHomer".
 Ok, this is telling me that the values aren't being set correctly. In fact, "This effect modifies the statistic () by an increment of ." shows me that it's being set as a Statistic Modifying effect, not an Item Removing effect. Easily fixed... and easily proven. Now, to the refactorings.

Rename SetAsIncreaseStatisticEffect to SetAsStatisticModifierEffect
 I want this effect to be used both for increasing and decreasing statistics. With test driven development, I can copy, paste, and test. Without, I'd have to resort to copy, paste, and pray.

Rename <foo>IDEffected
 Another pet peeve - (a) I like the ID to be at then end of the variable name, and (b) I'm dismayed that I lost track of the difference between the verb affect, the noun effect, and the gerund affected. Copy, paste, test. All Tests Pass (:

testStageManagerTakesUkelele
 One more layer of indirection. Showing the Ukulele to the stage manager makes him take it. I'll start there next time.

0 Comments:

Post a Comment

<< Home