unit-testing From simple to complex


Example

Same as, with writing classes - start with the simple cases, then add requirement (aka tests) and implementation (aka production code) case by case:

[Test]
public void EnsureThat_IsLeapYearIfDecimalMultipleOf4() {...}
[Test]
public void EnsureThat_IsNOTLeapYearIfDecimalMultipleOf100 {...}
[Test]
public void EnsureThat_IsLeapYearIfDecimalMultipleOf400 {...}

Don't forget the refactoring step, when finished with requirements - first refactor the code, then refactor the tests

When finished, you should have a complete, up to date and READABLE documentation of your class.