示例#1
0
        public void NegativeVotes__Throws()
        {
            ToDoListBuilder builder = new ToDoListBuilder();

            builder.Votes.Add(new TaskItem(), -1);

            Assert.That(() => builder.Build(), Throws.InvalidOperationException);
        }
示例#2
0
        public void Build__OrdersTasksByVotes()
        {
            ToDoListBuilder builder = new ToDoListBuilder();
            TaskItem        t1      = new TaskItem();
            TaskItem        t2      = new TaskItem();
            TaskItem        t3      = new TaskItem();

            builder.Votes.Add(t1, 10);
            builder.Votes.Add(t2, 0);
            builder.Votes.Add(t3, 1);

            ToDoList list = builder.Build();

            Assert.That(list.Count, Is.EqualTo(3));
            Assert.That(list[0], Is.EqualTo(t1));
            Assert.That(list[1], Is.EqualTo(t3));
            Assert.That(list[2], Is.EqualTo(t2));
        }
示例#3
0
        public void NoVotes__ReturnsEmptyList()
        {
            ToDoListBuilder builder = new ToDoListBuilder();

            Assert.That(builder.Build(), Is.Empty);
        }