/// <summary> /// Initializes a new instance of the <see cref="MockVSTask"/> class. /// </summary> /// <param name="vsTaskSchedulerService2">The <see cref="SVsTaskSchedulerService"/>.</param> /// <param name="context">The scheduling option for this task.</param> /// <param name="task">The task to execute.</param> /// <param name="asyncState">The async state object to store.</param> public MockVSTask(IVsTaskSchedulerService2 vsTaskSchedulerService2, uint context, Task <object> task, object?asyncState = null) { this.vsTaskSchedulerService2 = vsTaskSchedulerService2 ?? throw new ArgumentNullException(nameof(vsTaskSchedulerService2)); this.context = context; this.task = task ?? throw new ArgumentNullException(nameof(task)); this.asyncState = asyncState; }
/// <summary> /// Initializes a new instance of the <see cref="MockVSTask"/> class. /// </summary> /// <param name="vsTaskSchedulerService2">The <see cref="SVsTaskSchedulerService"/>.</param> /// <param name="context">The scheduling option for this task.</param> /// <param name="taskBody">The body to execute.</param> /// <param name="asyncState">The async state object to store.</param> public MockVSTask(IVsTaskSchedulerService2 vsTaskSchedulerService2, uint context, IVsTaskBody taskBody, object?asyncState = null) { this.vsTaskSchedulerService2 = vsTaskSchedulerService2 ?? throw new ArgumentNullException(nameof(vsTaskSchedulerService2)); this.context = context; this.task = new Task <object>( () => { taskBody.DoWork(this, 0, Array.Empty <IVsTask>(), out object result); return(result); }, this.cancellationTokenSource.Token); this.asyncState = asyncState; }
/// <summary> /// Initializes a new instance of the <see cref="MockVSTaskCompletionSource"/> class. /// </summary> /// <param name="vsTaskSchedulerService2">The <see cref="SVsTaskSchedulerService"/>.</param> /// <param name="asyncState">The state object.</param> public MockVSTaskCompletionSource(IVsTaskSchedulerService2 vsTaskSchedulerService2, object?asyncState = null) { this.vsTaskSchedulerService2 = vsTaskSchedulerService2 ?? throw new System.ArgumentNullException(nameof(vsTaskSchedulerService2)); this.asyncState = asyncState; }