public override ScopeMatchResult Matches(IWorkItem item)
 {
     var res = new ScopeMatchResult();
     res.Add(item.TypeName);
     res.Success = this.ApplicableTypes.Any(type => type.SameAs(item.TypeName));
     return res;
 }
 public override ScopeMatchResult Matches(IRequestContext requestContext, INotification notification)
 {
     var res = new ScopeMatchResult();
     res.Add(requestContext.CollectionName);
     res.Success = this.CollectionNames.Any(c => requestContext.CollectionName.SameAs(c));
     return res;
 }
        public override ScopeMatchResult Matches(IWorkItem item, INotification notification)
        {
            var res = new ScopeMatchResult();

            res.Add(item.TypeName);
            res.Success = this.ApplicableTypes.Any(type => type.SameAs(item.TypeName));
            return(res);
        }
Example #4
0
 public override ScopeMatchResult Matches(IRequestContext requestContext, INotification notification)
 {
     var res = new ScopeMatchResult();
     string projectName = requestContext.GetProjectName(new Uri(notification.ProjectUri));
     res.Add(projectName);
     res.Success = this.ProjectNames.Any(c => projectName.SameAs(c));
     return res;
 }
Example #5
0
        public override ScopeMatchResult Matches(IRequestContext requestContext, INotification notification)
        {
            var res = new ScopeMatchResult();

            res.Add(requestContext.CollectionName);
            res.Success = this.CollectionNames.Any(c => requestContext.CollectionName.SameAs(c));
            return(res);
        }
Example #6
0
        public override ScopeMatchResult Matches(IWorkItem item, INotification notification)
        {
            var res = new ScopeMatchResult();

            res.Add(notification.ChangeType.ToString());
            res.Success = this.ApplicableChanges.Any(type => type.SameAs(notification.ChangeType.ToString()));
            return(res);
        }
        public override ScopeMatchResult Matches(IRequestContext requestContext, INotification notification)
        {
            var    res         = new ScopeMatchResult();
            string projectName = requestContext.GetProjectName(new Uri(notification.ProjectUri));

            res.Add(projectName);
            res.Success = this.ProjectNames.Any(c => projectName.SameAs(c));
            return(res);
        }
        public override ScopeMatchResult Matches(IWorkItem item, INotification notification)
        {
            var res = new ScopeMatchResult();

            var trigger = this.FieldNames;

            var fields    = item.Fields.ToArray();
            var available = fields.Select(f => f.Name).Concat(fields.Select(f => f.ReferenceName));

            res.AddRange(available);
            res.Success = trigger.All(t => available.Contains(t, StringComparer.OrdinalIgnoreCase));

            return(res);
        }
        public override ScopeMatchResult Matches(IWorkItem item)
        {
            var res = new ScopeMatchResult();

            var trigger = this.FieldNames;

            var fields = item.Fields.ToArray();
            var available = fields.Select(f => f.Name).Concat(fields.Select(f => f.ReferenceName));

            res.AddRange(available);
            res.Success = trigger.All(t => available.Contains(t, StringComparer.OrdinalIgnoreCase));

            return res;
        }
Example #10
0
        /// <summary>
        /// Checks whether this policy matches the request.
        /// </summary>
        /// <param name="currentRequestContext">The requestcontext of the TFS event</param>
        /// <param name="currentNotification">The notification holding the WorkItemChangedEvent.</param>
        /// <returns>true if the policy matches all supplied checks.</returns>
        public override ScopeMatchResult Matches(IRequestContext currentRequestContext, INotification currentNotification)
        {
            var res = new ScopeMatchResult();

            IProjectProperty templateNameProperty = GetTemplateInfo(currentRequestContext, currentNotification);

            string processTemplateDescription = string.Format(
                "{0}",
                templateNameProperty?.Value);

            res.Add(processTemplateDescription);

            res.Success = this.MatchesName(templateNameProperty);
            return(res);
        }
Example #11
0
        /// <summary>
        /// Checks whether this policy matches the request.
        /// </summary>
        /// <param name="currentRequestContext">The requestcontext of the TFS event</param>
        /// <param name="currentNotification">The notification holding the WorkItemChangedEvent.</param>
        /// <returns>true if the policy matches all supplied checks.</returns>
        public override ScopeMatchResult Matches(IRequestContext currentRequestContext, INotification currentNotification)
        {
            var res = new ScopeMatchResult();

            var info = GetTemplateInfo(currentRequestContext, currentNotification);
            IProcessTemplateVersion currentversion       = info.Item1;
            IProjectProperty        templateNameProperty = info.Item2;

            string processTemplateDescription = string.Format(
                "{0} v{1}.{2} [{3}]",
                templateNameProperty?.Value,
                currentversion.Major,
                currentversion.Minor,
                currentversion.TypeId);

            res.Add(processTemplateDescription);

            res.Success = this.MatchesName(templateNameProperty) &&
                          this.MatchesId(currentversion) &&
                          this.MatchesMinVersion(currentversion) &&
                          this.MatchesMaxVersion(currentversion);
            return(res);
        }
Example #12
0
        /// <summary>
        /// Checks whether this policy matches the request.
        /// </summary>
        /// <param name="currentRequestContext">The requestcontext of the TFS event</param>
        /// <param name="currentNotification">The notification holding the WorkItemChangedEvent.</param>
        /// <returns>true if the policy matches all supplied checks.</returns>
        public override ScopeMatchResult Matches(IRequestContext currentRequestContext, INotification currentNotification)
        {
            var res = new ScopeMatchResult();

            var info = GetTemplateInfo(currentRequestContext, currentNotification);
            IProcessTemplateVersion currentversion = info.Item1;
            IProjectProperty templateNameProperty = info.Item2;

            string processTemplateDescription = string.Format(
                "{0} v{1}.{2} [{3}]",
                templateNameProperty?.Value,
                currentversion.Major,
                currentversion.Minor,
                currentversion.TypeId);

            res.Add(processTemplateDescription);

            res.Success = this.MatchesName(templateNameProperty)
                   && this.MatchesId(currentversion)
                   && this.MatchesMinVersion(currentversion)
                   && this.MatchesMaxVersion(currentversion);
            return res;
        }
Example #13
0
 public void RuleScopeMatchResult(RuleScope scope, ScopeMatchResult result)
 {
     this.logger.Log(
         LogLevel.Diagnostic,
         "Rule scope {0} {1} {2}",
         scope.DisplayName,
         result.Success ? "matches" : "does not match",
         result.Arguments);
 }