Production code

For such a small code base, the changes required by the new tests caused a fairly significant change. First, we added an IsComplete property to the Todo model:

internal class Todo{  public bool IsComplete { get; set; }  public string Description { get; set; }    internal void Validate()  {    Description = Description ?? throw new DescriptionRequiredException();  }}

The rest of the changes affect the TodoList class. A boolean property was added to toggle the visibility of completed items, the Complete method was modified to only mark the item as complete, and a where clause was added to the items retrieved from the list:

internal class TodoList{  private readonly List<Todo> _items = new List<Todo>();          public IEnumerable<Todo> Items ...

Get Improving your C# Skills now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.