private static void WriteSummaryInformation(ProjectRuleSetConflict conflictInfo, StringBuilder output) { output.AppendFormat(Strings.ConflictsSummaryHeader, conflictInfo.RuleSetInfo.RuleSetProjectFullName, CreateCommaSeparatedString(conflictInfo.RuleSetInfo.ConfigurationContexts)); output.AppendLine(); output.AppendFormat(Strings.ConflictDetailRuleSetInfo, conflictInfo.RuleSetInfo.RuleSetFilePath); output.AppendLine(); if (conflictInfo.Conflict.MissingRules.Any()) { output.AppendLine(Strings.ConflictDetailMissingRules); foreach (string ruleId in conflictInfo.Conflict.MissingRules.Select(r => r.FullId)) { output.Append(Indent); output.AppendLine(ruleId); } } if (conflictInfo.Conflict.WeakerActionRules.Any()) { output.AppendLine(Strings.ConflictDetailWeakenedRulesTitle); foreach (var keyValue in conflictInfo.Conflict.WeakerActionRules) { output.Append(Indent); output.AppendFormat(Strings.ConflictDetailWeakenedRulesDetail, keyValue.Key.FullId, keyValue.Key.Action, keyValue.Value); output.AppendLine(); } } }
public static ProjectRuleSetConflict CreateConflict(string projectFilePath = "project.csproj", string baselineRuleSet = "baseline.ruleset", string projectRuleSet = "project.csproj", int numberOfConflictingRules = 1) { IEnumerable<string> ids = Enumerable.Range(0, numberOfConflictingRules).Select(i => "id" + i); var ruleSet = TestRuleSetHelper.CreateTestRuleSetWithRuleIds(ids); var conflict = new ProjectRuleSetConflict( new RuleConflictInfo(ruleSet.Rules, new Dictionary<RuleReference, RuleAction>()), new RuleSetInformation(projectFilePath, baselineRuleSet, projectRuleSet, null)); return conflict; }
public void AddConflict(ProjectRuleSetConflict conflict) { this.currentConflicts.Add(conflict); }