I am making a role playing game for fun and attempting to use TDD while developing it. Many of the TDD examples I see focus on creating the test first, then creating objects that are needed to get the test to pass.
For example:
[Test]
public void Character_WhenHealthIsBelowZero_IsDead()
{
// create default character with 10 health
Character character = new Character();
character.SubtractHealth(20);
Assert.That(character.IsAlive, Is.EqualTo(false));
}
So based on this I'll create the character class and appropriate properties/methods. This seems fine and all but should my class design really come out of continually refining my tests? Is that better than mapping out the possible objects that my game will need ahead of time? For example, I would normally think of a base Character class, then subclasses such as Wizard, Fighter, Theif.
Or is a balanced approach the way to go? One where I map out the possible classes and hierarchy I'll need but writing tests first to verify they are actually needed?