public void AddToDoItemCompletedEvent() { ToDoItem item = new ToDoItem(); item.MarkComplete(); Assert.True(item.Events.Count(x => x.GetType() == typeof(ToDoItemCompletedEvent)) == 1); }
public void SetIsDoneToTrue() { var item = new ToDoItem(); item.MarkComplete(); Assert.True(item.IsDone); }
public void MarkIsDoneToTrue() { ToDoItem item = new ToDoItem(); item.MarkComplete(); Assert.True(item.IsDone); }
public void RaiseToDoItemCompletedEvent() { var item = new ToDoItem(); item.MarkComplete(); Assert.Single(item.Events); Assert.IsType <ToDoItemCompletedEvent>(item.Events.First()); }
public void RaiseToDoItemCompletedEvent() { var item = new ToDoItem(); item.MarkComplete(); Assert.Equal(1, item.Events.Count()); Assert.IsType <ToDoItemCompletedEvent>(item.Events.First()); }
public void ShouldRaiseToDoItemCompletedEvent() { var item = new ToDoItem(); item.MarkComplete(); Assert.AreEqual(1, item.Events.Count); Assert.IsInstanceOfType(item.Events.FirstOrDefault(), typeof(ToDoItemCompletedEvent)); }
public ToDoItemDTO MarkComplete(int id) { ToDoItem todo = _repository.GetById <ToDoItem>(id); todo.MarkComplete(); _repository.Update(todo); var res = ToDoItemDTO.FromToDoItem(todo); return(res); }
public void SetIsCompletedToTrue() { ToDoItem item = new ToDoItem() { Category = "UnitTest", Title = "Mark me as completed", //IsCompleted = false // private property that can only be set by MarkComplete method }; item.MarkComplete(); Assert.True(item.IsCompleted); }
public void FilterCollectionToOnlyReturnItemsWithIsDoneFalse() { var item1 = new ToDoItem(); var item2 = new ToDoItem(); var item3 = new ToDoItem(); item3.MarkComplete(); var items = new List <ToDoItem>() { item1, item2, item3 }; var spec = new IncompleteItemsSpecification(); List <ToDoItem> filteredList = items .Where(spec.WhereExpressions.First().Compile()) .ToList(); Assert.Contains(item1, filteredList); Assert.Contains(item2, filteredList); Assert.DoesNotContain(item3, filteredList); }
public void FilterCollectionToOnlyReturnItemsWithIsDoneFalse() { var item1 = new ToDoItem(); var item2 = new ToDoItem(); var item3 = new ToDoItem(); item3.MarkComplete(); var items = new List <ToDoItem>() { item1, item2, item3 }; var spec = new IncompleteItemsSpec(); var filteredList = spec.Evaluate(items); Assert.Contains(item1, filteredList); Assert.Contains(item2, filteredList); Assert.DoesNotContain(item3, filteredList); }