Commit 8c42acc4 authored by Steve Smith's avatar Steve Smith

Updating ToDoItem

parent fd6102e1
...@@ -5,7 +5,7 @@ namespace CleanArchitecture.Core.Entities ...@@ -5,7 +5,7 @@ namespace CleanArchitecture.Core.Entities
{ {
public class ToDoItem : BaseEntity public class ToDoItem : BaseEntity
{ {
public string Title { get; set; } public string Title { get; set; } = string.Empty;
public string Description { get; set; } public string Description { get; set; }
public bool IsDone { get; private set; } public bool IsDone { get; private set; }
......
using CleanArchitecture.Core.Events; using CleanArchitecture.Core.Entities;
using CleanArchitecture.Core.Events;
using System.Linq; using System.Linq;
using Xunit; using Xunit;
...@@ -9,7 +10,10 @@ namespace CleanArchitecture.Tests.Core.Entities ...@@ -9,7 +10,10 @@ namespace CleanArchitecture.Tests.Core.Entities
[Fact] [Fact]
public void SetsIsDoneToTrue() public void SetsIsDoneToTrue()
{ {
var item = new ToDoItemBuilder().Build(); var item = new ToDoItemBuilder()
.WithDefaultValues()
.Description("")
.Build();
item.MarkComplete(); item.MarkComplete();
......
...@@ -4,7 +4,7 @@ namespace CleanArchitecture.Tests ...@@ -4,7 +4,7 @@ namespace CleanArchitecture.Tests
{ {
public class ToDoItemBuilder public class ToDoItemBuilder
{ {
private readonly ToDoItem _todo = new ToDoItem(); private ToDoItem _todo = new ToDoItem();
public ToDoItemBuilder Id(int id) public ToDoItemBuilder Id(int id)
{ {
...@@ -24,6 +24,13 @@ namespace CleanArchitecture.Tests ...@@ -24,6 +24,13 @@ namespace CleanArchitecture.Tests
return this; return this;
} }
public ToDoItemBuilder WithDefaultValues()
{
_todo = new ToDoItem() { Id = 1, Title = "Test Item", Description = "Test Description" };
return this;
}
public ToDoItem Build() => _todo; public ToDoItem Build() => _todo;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment