Esempio n. 1
0
        /// <summary>
        ///     Builds the work item.
        /// </summary>
        /// <param name="projectName">The project name.</param>
        /// <param name="workItemTypeName">Name of the work item type.</param>
        /// <param name="fieldValues">The field values.</param>
        /// <returns>IWorkItem.</returns>
        public IWorkItem BuildWorkItem(string projectName, string workItemTypeName, IReadOnlyList <KeyValuePair <string, object> > fieldValues)
        {
            Dictionary <string, object> dictionary = fieldValues.ToDictionary(field => field.Key, field => field.Value);

            IWorkItemStore          workItemStore = WorkItemStore();
            IProject                project       = workItemStore.Projects[projectName];
            IWorkItemTypeCollection workItemTypes = project.WorkItemTypes;
            IWorkItemType           workItemType  = null;

            foreach (IWorkItemType entry in workItemTypes)
            {
                if (entry.Name == workItemTypeName)
                {
                    workItemType = entry;
                }
            }

            var workItem = new WorkItem(WorkItemTypeWrapper.GetInstance(workItemType));

            foreach (KeyValuePair <string, object> pair in dictionary)
            {
                string fieldName  = pair.Key;
                object fieldValue = pair.Value;
                workItem[fieldName] = fieldValue;
            }
            return(WorkItemWrapper.GetWrapper(workItem));
        }
Esempio n. 2
0
 public MockProject(Guid id, string name, Uri uri, IWorkItemTypeCollection wits, IWorkItemClassificationNodeCollection <int> areas, IWorkItemClassificationNodeCollection <int> iterations)
     : base(
         id,
         name,
         uri,
         new Lazy <IWorkItemTypeCollection>(() => wits),
         new Lazy <IWorkItemClassificationNodeCollection <int> >(() => areas),
         new Lazy <IWorkItemClassificationNodeCollection <int> >(() => iterations))
 {
 }
Esempio n. 3
0
 /// <summary>
 ///     Gets the work item types.
 /// </summary>
 /// <param name="projectName">Name of the project.</param>
 /// <returns>Task&lt;IReadOnlyList&lt;IWorkItemType&gt;&gt;.</returns>
 public Task <IReadOnlyDictionary <string, IWorkItemType> > GetWorkItemTypes(string projectName)
 {
     return(AsyncOperation(() =>
     {
         IWorkItemStore workItemStore = WorkItemStore();
         IProject project = workItemStore.Projects[projectName];
         IWorkItemTypeCollection workItemTypes = project.WorkItemTypes;
         var result = new Dictionary <string, IWorkItemType>();
         foreach (IWorkItemType item in workItemTypes)
         {
             result.Add(item.Name, item);
         }
         return (IReadOnlyDictionary <string, IWorkItemType>)result;
     }));
 }
 partial void Import_PreCondition(IWorkItemTypeCollection instance, ref String definition);
 partial void Import_PostValidate(IWorkItemTypeCollection instance, String definition);
Esempio n. 6
0
 public bool Equals(IWorkItemTypeCollection other)
 {
     return(WorkItemTypeCollectionComparer.Default.Equals(this, other));
 }