Esempio n. 1
0
        private void OnTaskCancelCompletedMasterCommand(TaskCancelCompletedMasterCommand message)
        {
            Trace.WriteLine("ENTER: Task '{0}' canceled by processor '{1}' ...".FormatInvariant(message.TaskId, message.TaskProcessorId));

            if (!message.IsTaskProcessorStopping)
            {
                this.AssignTasksToProcessor(message.TaskProcessorId);
            }

            Trace.WriteLine("EXIT: Task '{0}' canceled by processor '{1}'.".FormatInvariant(message.TaskId, message.TaskProcessorId));
        }
Esempio n. 2
0
        public void AddTaskCancelCompletedMasterCommand()
        {
            Guid taskId = Guid.NewGuid();

            Guid taskProcessorId = Guid.NewGuid();

            DateTime timestamp = DateTime.UtcNow;

            this.Sender.NotifyTaskCancelCompleted(taskId, timestamp, taskProcessorId, true);

            Thread.Sleep(this.Timeout);

            TaskCancelCompletedMasterCommand command = this.MasterCommands.OfType <TaskCancelCompletedMasterCommand>().First(c => c.TaskId == taskId);

            Assert.AreEqual(taskProcessorId, command.TaskProcessorId);

            this.AssertEquals(timestamp, command.TimestampUtc);

            Assert.IsTrue(command.IsTaskProcessorStopping);
        }