/// <summary> /// Adds a list of violations to the task provider. /// </summary> /// <param name="violations">The list of violations to add.</param> public void AddResults(List <ViolationInfo> violations) { Param.AssertNotNull(violations, "violations"); StyleCopTrace.In(violations); this.SuspendRefresh(); var hierarchyItems = new Dictionary <string, IVsHierarchy>(); for (int index = 0; index < violations.Count; index++) { ViolationInfo violation = violations[index]; IVsHierarchy hierarchyItem = hierarchyItems.ContainsKey(violation.File) ? hierarchyItems[violation.File] : null; var task = new ViolationTask(this.serviceProvider, violation, hierarchyItem); hierarchyItem = task.HierarchyItem; if (!hierarchyItems.ContainsKey(violation.File)) { hierarchyItems.Add(violation.File, hierarchyItem); } this.Tasks.Add(task); } this.ResumeRefresh(); StyleCopTrace.Out(); }
/// <summary> /// Adds a list of violations to the task provider. /// </summary> /// <param name="violations">The list of violations to add.</param> public void AddResults(List<ViolationInfo> violations) { Param.AssertNotNull(violations, "violations"); StyleCopTrace.In(violations); this.SuspendRefresh(); var hierarchyItems = new Dictionary<string, IVsHierarchy>(); for (int index = 0; index < violations.Count; index++) { ViolationInfo violation = violations[index]; IVsHierarchy hierarchyItem = hierarchyItems.ContainsKey(violation.File) ? hierarchyItems[violation.File] : null; var task = new ViolationTask(this.serviceProvider, violation, hierarchyItem); hierarchyItem = task.HierarchyItem; if (!hierarchyItems.ContainsKey(violation.File)) { hierarchyItems.Add(violation.File, hierarchyItem); } this.Tasks.Add(task); } this.ResumeRefresh(); StyleCopTrace.Out(); }
/// <summary> /// Adds a single violation to the task provider. /// </summary> /// <param name="violation">The violation to add.</param> private void AddResult(ViolationInfo violation) { Param.AssertNotNull(violation, "violation"); Task task = new ViolationTask(this.serviceProvider, violation); this.Tasks.Add(task); }
public void MyTestInitialize() { // Creating a package will set the factory service provider. this.package = new StyleCopVSPackage(); this.mockServiceProvider = new Mock<IServiceProvider>(); this.violation = CreateDummyViolationInfo(); this.package.Core.DisplayUI = false; this.taskUnderTest = new ViolationTask(this.package, this.violation, null); this.taskUnderTestShell = taskUnderTest; }
public void MyTestCleanup() { this.taskUnderTest = null; this.taskUnderTestShell = null; this.taskUnderTest = null; }
public void MyTestInitialize() { // Creating a package will set the factory service provider. this.package = new StyleCopVSPackage(); this.mockServiceProvider = new Mock<IServiceProvider>(); // Creates a dummy violation (In visual studio the violation is displayed in Error List panel) this.violation = CreateDummyViolationInfo(); Assert.IsNotNull(this.package, "this.package is null"); PrivateObject actual = new PrivateObject(this.package, new PrivateType(typeof(StyleCopVSPackage))); StyleCopCore core = (StyleCopCore)actual.GetFieldOrProperty("Core"); Assert.IsNotNull(core, "core is null"); core.DisplayUI = false; this.taskUnderTest = new ViolationTask(this.package, this.violation, null); this.taskUnderTestShell = this.taskUnderTest; }