Esempio n. 1
0
        private void OnTaskAssignedToProcessor(object sender, TaskAssignedEventArgs e)
        {
            TaskViewModel taskViewModel = this.pendingTasks.FirstOrDefault(t => t.TaskId == e.TaskId);

            if (taskViewModel != null)
            {
                App.Current.Dispatcher.InvokeAsync(() =>
                {
                    taskViewModel.Status          = "Assigned";
                    taskViewModel.TaskProcessorId = e.TaskProcessorId;
                });
            }
        }
Esempio n. 2
0
        public void RaiseTaskAssignedToProcessor()
        {
            Guid taskProcessorId = Guid.NewGuid();

            Guid taskId = Guid.NewGuid();

            this.Receiver.SubscribeForChannels(MessageBusChannel.TaskAssigned);

            TaskAssignedEventArgs args = Helpers.WaitForEvent <TaskAssignedEventArgs>(
                this.Timeout,
                handler => this.Receiver.TaskAssigned += handler,
                () => this.Sender.NotifyTaskAssigned(taskId, taskProcessorId));

            Assert.AreEqual(taskId, args.TaskId);
            Assert.AreEqual(taskProcessorId, args.TaskProcessorId);
        }