Tuesday, July 25, 2006

xUnit with a twist

Imagine nUnit coupled with Object Mother and dependency injection.

You would be able to write a test and specify the test objects you wish to manipulate by adding parameters to the method.

[Test]
public void adding_a_task_to_a_project_causes_the_tasks_predicted_start_date_to_be_set( IProject mockProject, Task washCloths )
{
// ... test stuff as normal
}

Parameters with the name 'mockX' could cause mock instances to be created. 'washCloths' would be an example of a named instance, so a specific instance of task would be created in a known state. 'anyProject' could return a simple project instance.

Just a thought... but I like it.

No comments:

GitHub Projects