public class ToDoItemBuilder
{
private ToDoItem _todo = new ToDoItem();
public ToDoItemBuilder Id(int id)
{
_todo.Id = id;
return this;
}
public ToDoItemBuilder Title(string title)
{
_todo.Title = title;
return this;
}
public ToDoItemBuilder Description(string description)
{
_todo.Description = description;
return this;
}
public ToDoItemBuilder WithDefaultValues()
{
_todo = new ToDoItem { Id = 1, Title = "title", Description = "desc" };
return this;
}
public ToDoItem Build() => _todo;
}
public class ToDoItem : BaseEntity, IAggregateRoot
{
public string Title { get; set; } = string.Empty;
public string Description { get; set; }
public bool IsDone { get; private set; }
......
}