コード例 #1
0
        public void Assigning_a_task_should_raise_TaskAssigned_event()
        {
            var state = new TodoItemState();
            var todoItem = new TodoItem(state);
            todoItem.AssignTask("Task 1");

            todoItem.GetEvents().Should().ContainItemsAssignableTo<TaskAssigned>();
        }
コード例 #2
0
        public void AssignTask_should_add_task_to_todo_item()
        {
            var state = new TodoItemState();
            var todoItem = new TodoItem(state);
            todoItem.AssignTask("Task 1");

            state.Tasks.Should().Contain(x => x.Description == "Task 1");
        }
コード例 #3
0
        public void AssignTasked_should_have_id_generated()
        {
            var state = new TodoItemState();
            var todoItem = new TodoItem(state);
            todoItem.AssignTask("Task 1");
            todoItem.AssignTask("Task 2");

            state.Tasks.First().Id.Should().Be(1);
            state.Tasks.Last().Id.Should().Be(2);
        }
コード例 #4
0
        public void CompleteTask_should_mark_task_as_completed()
        {
            var task = new Task(1, "Task 1");
            var state = new TodoItemState
            {
                Tasks = new List<Task>{ task }
            };

            var todoItem = new TodoItem(state);

            todoItem.CompleteTask(task.Id);

            task.Completed.Should().BeTrue();
        }
コード例 #5
0
        public void Completing_all_tasks_should_make_todo_item_completed()
        {
            var state = new TodoItemState
            {
                Tasks = new List<Task>
                {
                    new Task(1, "Task 1"),
                    new Task(2, "Task 2")
                }
            };

            var todoItem = new TodoItem(state);

            todoItem.CompleteTask(1);
            todoItem.CompleteTask(2);

            state.Completed.Should().BeTrue();
        }
コード例 #6
0
        public void Completing_all_tasks_should_raise_todo_item_completed_event()
        {
            var state = new TodoItemState
            {
                Tasks = new List<Task>
                {
                    new Task(1, "Task 1"),
                    new Task(2, "Task 2")
                }
            };

            var todoItem = new TodoItem(state);
            todoItem.CompleteTask(1);
            todoItem.CompleteTask(2);

            todoItem.GetEvents().Should().ContainItemsAssignableTo<TodoItemCompleted>();
        }