protected override void ProcessRecordInEH() { if (ParameterSetName != "QueryByWIQL" && (WorkItem == null || WorkItem.Count == 0)) { throw new PSArgumentException("No filter has been specified. Please specify at least 1 filter for removing the work items."); } WorkItemStore workItemStore = EnsureWorkItemStore(); List <WorkItem> deletingWorkItems = QueryWorkItems(workItemStore).ToList(); List <int> idOfDeletingWorkItems = deletingWorkItems.Select(x => x.Id).ToList(); WriteVerbose(string.Format("Removing workitems with id: {0}.", string.Join(", ", idOfDeletingWorkItems))); ICollection <WorkItemOperationError> errors = workItemStore.DestroyWorkItems(idOfDeletingWorkItems); var errorMap = errors.ToDictionary(x => x.Id, x => x); List <RemoveTfsWorkItemResult> results = deletingWorkItems.Select((x) => { WorkItemOperationError error = null; errorMap.TryGetValue(x.Id, out error); return(new RemoveTfsWorkItemResult() { WorkItem = x, Error = error }); }).ToList(); foreach (var result in results) { WriteObject(result); } }
internal static WorkItemOperationErrorWrapper GetInstance() { WorkItemOperationError real = default(WorkItemOperationError); RealInstanceFactory(ref real); var instance = (WorkItemOperationErrorWrapper)WorkItemOperationErrorWrapper.GetWrapper(real); InstanceFactory(ref instance); if (instance == null) { Assert.Inconclusive("Could not Create Test Instance"); } return(instance); }
static partial void RealInstanceFactory(ref WorkItemOperationError real, [CallerMemberName] string callerName = "");