Test small

One of the most important things to consider when doing TDD is the size and scope of your tests. TDD is an exercise in fully understanding the problem you are trying to solve and being able to break the solution up into as many tiny little pieces as possible.

As an example, let us consider something simple: an application to manage a list of items that need to be done. How can we break up the use cases for this application?

First, using what we discussed with yak shaving, we can verify that the application even exists.

public class ToDoApplicationTests
{
[Fact]
public void TodoListExists()
{
var todo = new TodoList();

Assert.NotNull(todo);
}
}

internal class TodoList
{
public TodoList()
{
}
}

Next, verify that you are able to retrieve a listing of items to be done.

[Fact]
public void CanGetTodos()
{
// Arrange
var todo = new TodoList();

// Act
var result = todo.Items;

// Assert
Assert.NotNull(result);
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.255.5