When to Write Validation Code?

First thing.

How else will you write the tests for failing and passing conditions?