Ejemplo n.º 1
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));
            }
        }
Ejemplo n.º 2
0
        public static void AddRelatedLink(this IWorkItem workItem, IWorkItemStore store, int[] targets)
        {
            if (workItem == null)
            {
                throw new ArgumentNullException(nameof(workItem));
            }
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }
            if (targets.Length == 0)
            {
                throw new ArgumentException("Value cannot be an empty collection.", nameof(targets));
            }

            var end = store.WorkItemLinkTypes[CoreLinkTypeReferenceNames.Related].ForwardEnd;

            foreach (var id in targets)
            {
                workItem.Links.Add(workItem.CreateRelatedLink(id, end));
            }
        }
Ejemplo n.º 3
0
        public static void AddChildLink([NotNull] this IWorkItem workItem, [NotNull] IWorkItemStore store, int childId)
        {
            Contract.Requires(workItem != null);
            Contract.Requires(store != null);
            Contract.Requires(childId > 0);

            if (workItem == null)
            {
                throw new ArgumentNullException(nameof(workItem));
            }
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }
            if (childId == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(childId));
            }

            var end = store.GetChildLinkTypeEnd();

            workItem.Links.Add(workItem.CreateRelatedLink(childId, end));
        }
Ejemplo n.º 4
0
        public static void AddRelatedLink([NotNull] this IWorkItem workItem, [NotNull] IWorkItemStore store, int targetId)
        {
            Contract.Requires(workItem != null);
            Contract.Requires(store != null);
            Contract.Requires(targetId > 0);

            if (workItem == null)
            {
                throw new ArgumentNullException(nameof(workItem));
            }
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }
            if (targetId == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(targetId));
            }

            var end = store.WorkItemLinkTypes[CoreLinkTypeReferenceNames.Related].ForwardEnd;

            workItem.Links.Add(workItem.CreateRelatedLink(targetId, end));
        }