Exemplo n.º 1
0
        public void AddTaskQueue()
        {
            var mock = new Moq.Mock<ITask>();

            var queue = new TaskQueue();
            queue.Add(mock.Object);

            Assert.That(queue.Count, Is.EqualTo(1));
        }
Exemplo n.º 2
0
        public void TickTaskWithRemainingTime()
        {
            var result = new Moq.Mock<ITaskResult>(MockBehavior.Strict);
            var mock = new Moq.Mock<ITask>(MockBehavior.Strict);

            mock.Setup(x => x.Execute()).Returns(result.Object);
            result.SetupGet(f => f.TimeRemaining).Returns(1);

            var queue = new TaskQueue();
            queue.Add(mock.Object);

            var count = queue.Tick();
            Assert.That(count, Is.EqualTo(0));
            Assert.That(queue.Count, Is.EqualTo(1));
        }