コード例 #1
0
        public void AddToDoItemCompletedEvent()
        {
            ToDoItem item = new ToDoItem();

            item.MarkComplete();
            Assert.True(item.Events.Count(x => x.GetType() == typeof(ToDoItemCompletedEvent)) == 1);
        }
コード例 #2
0
        public void SetIsDoneToTrue()
        {
            var item = new ToDoItem();

            item.MarkComplete();

            Assert.True(item.IsDone);
        }
コード例 #3
0
        public void MarkIsDoneToTrue()
        {
            ToDoItem item = new ToDoItem();

            item.MarkComplete();

            Assert.True(item.IsDone);
        }
コード例 #4
0
        public void RaiseToDoItemCompletedEvent()
        {
            var item = new ToDoItem();

            item.MarkComplete();

            Assert.Single(item.Events);
            Assert.IsType <ToDoItemCompletedEvent>(item.Events.First());
        }
コード例 #5
0
        public void RaiseToDoItemCompletedEvent()
        {
            var item = new ToDoItem();

            item.MarkComplete();

            Assert.Equal(1, item.Events.Count());
            Assert.IsType <ToDoItemCompletedEvent>(item.Events.First());
        }
コード例 #6
0
        public void ShouldRaiseToDoItemCompletedEvent()
        {
            var item = new ToDoItem();

            item.MarkComplete();

            Assert.AreEqual(1, item.Events.Count);
            Assert.IsInstanceOfType(item.Events.FirstOrDefault(), typeof(ToDoItemCompletedEvent));
        }
コード例 #7
0
        public ToDoItemDTO MarkComplete(int id)
        {
            ToDoItem todo = _repository.GetById <ToDoItem>(id);

            todo.MarkComplete();
            _repository.Update(todo);
            var res = ToDoItemDTO.FromToDoItem(todo);

            return(res);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
    }