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; }); } }
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); }