Example #1
0
        public void GetQueryHierarchy_UnitTest()
        {
            IWorkItemStore  instance = GetTestInstance();
            IQueryHierarchy actual   = instance.GetQueryHierarchy(null);

            Assert.IsNotNull(actual);
        }
Example #2
0
        public void TreeIdToPath_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();
            string         actual   = instance.TreeIdToPath(0);

            Assert.IsNotNull(actual);
        }
Example #3
0
        public void GetReferencingWorkItemUris_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();

            Uri[] actual = instance.GetReferencingWorkItemUris(new Uri(VSOClientManager.VsoCollection));
            Assert.IsNotNull(actual);
        }
Example #4
0
        public void GetStoredQuery_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();
            IStoredQuery   actual   = instance.GetStoredQuery(Guid.Empty);

            Assert.IsNotNull(actual);
        }
Example #5
0
        public void DestroyWorkItems_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();
            IEnumerable <IWorkItemOperationError> actual = instance.DestroyWorkItems(new int[] {});

            Assert.IsNotNull(actual);
        }
 public TeamFoundationServerWorkItemQueryProvider(IWorkItemStore workItemStore,
                                                  IWiqlQueryBuilder queryBuilder, IWorkItemMapper workItemMapper)
 {
     WorkItemStore    = workItemStore;
     WiqlQueryBuilder = queryBuilder;
     WorkItemMapper   = workItemMapper;
 }
Example #7
0
        public void SendUpdatePackage_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();
            XmlElement     result;

            instance.SendUpdatePackage(null, out result, false);
        }
Example #8
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));
        }
Example #9
0
        public void GetWorkItem_UnitTest5()
        {
            IWorkItemStore instance = GetTestInstance();
            IWorkItem      actual   = instance.GetWorkItem(194);

            Assert.IsNotNull(actual);
        }
Example #10
0
        public void Projects_UnitTest()
        {
            IWorkItemStore     instance = GetTestInstance();
            IProjectCollection actual   = instance.Projects;

            Assert.IsNotNull(actual);
        }
Example #11
0
        public static void AddChildrenLink([NotNull] this IWorkItem workItem, [NotNull] IWorkItemStore store, [NotNull] params int[] childrenIds)
        {
            Contract.Requires(workItem != null);
            Contract.Requires(store != null);
            Contract.Requires(childrenIds != null);
            Contract.Requires(childrenIds.Length > 0);

            if (workItem == null)
            {
                throw new ArgumentNullException(nameof(workItem));
            }
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }
            if (childrenIds == null)
            {
                throw new ArgumentNullException(nameof(childrenIds));
            }
            if (childrenIds.Length == 0)
            {
                throw new ArgumentNullException(nameof(childrenIds));
            }

            var end = store.GetChildLinkTypeEnd();

            foreach (var id in childrenIds)
            {
                workItem.Links.Add(workItem.CreateRelatedLink(id, end));
            }
        }
Example #12
0
        public void GetWorkItem_UnitTest4()
        {
            IWorkItemStore instance = GetTestInstance();
            IWorkItem      actual   = instance.GetWorkItem(new Uri(VSOClientManager.VsoCollection), 0);

            Assert.IsNotNull(actual);
        }
Example #13
0
        public void GetWorkItemIdsForArtifactUris_UnitTest()
        {
            IWorkItemStore             instance = GetTestInstance();
            Dictionary <string, int[]> actual   = instance.GetWorkItemIdsForArtifactUris(new string[] {}, DateTime.Now);

            Assert.IsNotNull(actual);
        }
Example #14
0
        public void BatchSave_UnitTest1()
        {
            IWorkItemStore instance = GetTestInstance();

            IBatchSaveError[] actual = instance.BatchSave(new IWorkItem[] {}, ISaveFlags.None);
            Assert.IsNotNull(actual);
        }
Example #15
0
        public void SyncToCache_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();
            bool           actual   = instance.SyncToCache();

            Assert.IsNotNull(actual);
        }
Example #16
0
        public void GetQueryDefinition_UnitTest()
        {
            IWorkItemStore   instance = GetTestInstance();
            IQueryDefinition actual   = instance.GetQueryDefinition(Guid.Empty);

            Assert.IsNotNull(actual);
        }
Example #17
0
        public void GetPersonNameById_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();
            string         actual   = instance.GetPersonNameById(0);

            Assert.IsNotNull(actual);
        }
Example #18
0
        public void GetNodePermissions_UnitTest()
        {
            IWorkItemStore    instance = GetTestInstance();
            IPsUserRightsMask actual   = instance.GetNodePermissions(0);

            Assert.IsNotNull(actual);
        }
Example #19
0
        public void GetGlobalAndProjectGroups_UnitTest()
        {
            IWorkItemStore instance = GetTestInstance();
            List <string>  actual   = instance.GetGlobalAndProjectGroups(0, false);

            Assert.IsNotNull(actual);
        }
Example #20
0
 public static IWorkItemLinkType GetLinkType(this IWorkItemStore store, string linkTypeReferenceName)
 {
     if (store == null)
     {
         throw new ArgumentNullException(nameof(store));
     }
     return(store.WorkItemLinkTypes[linkTypeReferenceName]);
 }
Example #21
0
        public void Query_UnitTest5()
        {
            IWorkItemStore      instance = GetTestInstance();
            const string        wiql     = "SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.Tags] FROM WorkItems";
            IWorkItemCollection actual   = instance.Query(wiql);

            Assert.IsNotNull(actual);
        }
Example #22
0
        public void QueryCount_UnitTest1()
        {
            IWorkItemStore instance = GetTestInstance();
            const string   wiql     = "SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.Tags] FROM WorkItems";
            int            actual   = instance.QueryCount(wiql, null);

            Assert.IsNotNull(actual);
        }
Example #23
0
        public void GetWorkItem_UnitTest2()
        {
            IWorkItemStore   instance    = GetTestInstance();
            CredentialsStore credentials = CredentialsProvider.Read(@"..\..\..\RestCredentials.xml");
            IWorkItem        actual      = instance.GetWorkItem(new Uri(credentials.VsoCollection));

            Assert.IsNotNull(actual);
        }
Example #24
0
 internal FieldDefinitionCollection(IWorkItemStore store)
     : base(store?.Projects.SelectMany(s => s.WorkItemTypes).SelectMany(s => s.FieldDefinitions).Select(s => s).ToList())
 {
     if (store == null)
     {
         throw new ArgumentNullException(nameof(store));
     }
 }
        /// <summary>
        ///     Gets the test instance.
        /// </summary>
        /// <returns>IProject.</returns>
        internal static IProject GetTestInstance()
        {
            IWorkItemStore     workItemStore = WorkItemStoreImpl_UnitTests.GetTestInstance();
            IProjectCollection projects      = workItemStore.Projects;
            IProject           project       = projects["RestPlaypen"];

            return(project);
        }
Example #26
0
 public static IWorkItemLinkTypeEnd GetChildLinkTypeEnd(this IWorkItemStore store)
 {
     if (store == null)
     {
         throw new ArgumentNullException(nameof(store));
     }
     return(store.GetLinkType(CoreLinkTypeReferenceNames.Hierarchy).ReverseEnd);
 }
Example #27
0
 public static IIdentityManagementService GetIdentityManagementService([NotNull] this IWorkItemStore workItemStore)
 {
     if (workItemStore == null)
     {
         throw new ArgumentNullException(nameof(workItemStore));
     }
     return(workItemStore.TeamProjectCollection.GetIdentityManagementService());
 }
Example #28
0
 /// <summary>
 ///     Gets the work items.
 /// </summary>
 /// <param name="ids">The ids.</param>
 /// <returns>Task&lt;IList&lt;JsonWorkItem&gt;&gt;.</returns>
 public Task <IReadOnlyList <IWorkItem> > GetWorkItems(IEnumerable <int> ids)
 {
     return(AsyncOperation(() =>
     {
         IWorkItemStore workItemStore = WorkItemStore();
         var result = (IReadOnlyList <IWorkItem>)ids.Select(id => workItemStore.GetWorkItem(id)).ToList();
         return result;
     }));
 }
 public RelativesAwareTeamFoundationServerWorkItemQueryProvider(
     IWorkItemStore workItemStore,
     IWiqlQueryBuilder queryBuilder,
     IWorkItemMapper workItemMapper,
     IFieldMapper fieldMapper)
     : base(workItemStore, queryBuilder, workItemMapper)
 {
     _fieldMapper = fieldMapper;
 }
Example #30
0
        public override void Given()
        {
            var workItems = new List <IWorkItem>
            {
                new MockWorkItem("SimpleMockWorkItem", new Dictionary <string, object>
                {
                    { "ID", 1 },
                    { "IntField", 2 }
                }),
                new MockWorkItem("SimpleMockWorkItem", new Dictionary <string, object>
                {
                    { "ID", 2 },
                    { "IntField", 4 }
                })
                ,
                new MockWorkItem("SimpleMockWorkItem", new Dictionary <string, object>
                {
                    { "ID", 3 },
                    { "IntField", 3 }
                })
                ,
                new MockWorkItem("SimpleMockWorkItem", new Dictionary <string, object>
                {
                    { "ID", 4 },
                    { "IntField", 4 }
                })
                ,
                new MockWorkItem("SimpleMockWorkItem", new Dictionary <string, object>
                {
                    { "ID", 5 },
                    { "IntField", 5 }
                })
            };

            var links = new[] {
                new MockWorkItemLinkInfo(0, 3),
                new MockWorkItemLinkInfo(3, 1),
                new MockWorkItemLinkInfo(3, 2),
                new MockWorkItemLinkInfo(0, 4),
                new MockWorkItemLinkInfo(0, 5)
            };

            WorkItemStore = new MockWorkItemStore(workItems, links);
            FieldMapper   = new CachingFieldMapper(new FieldMapper());

            var propertyInspector = new PropertyInspector(PropertyReflector);
            var mapperStrategies  = new IWorkItemMapperStrategy[]
            {
                new AttributeMapperStrategy(propertyInspector,
                                            new TypeParser()),
                new WorkItemLinksMapperStrategy(propertyInspector, WorkItemStore)
            };

            Builder = new WiqlQueryBuilder(new WiqlTranslator(FieldMapper), new PartialEvaluator(), new QueryRewriter());
            Mapper  = new WorkItemMapper(mapperStrategies);
        }