/// <summary> /// Initializes the object instance. /// </summary> protected internal override void Initialize() { base.Initialize(); StyleCopVSPackage package = this.ServiceProvider.GetService(typeof(StyleCopVSPackage)) as StyleCopVSPackage; Debug.Assert(package != null, "Unable to locate the package"); this.core = package.Core; this.helper = package.Helper; }
public void MyTestInitialize() { // Creating a package wil lset the facoctory service provider. this.package = new StyleCopVSPackage(); this.mockServiceProvider = new Mock<IServiceProvider>(); this.violation = CreateDummyViolationInfo(); StyleCopVSPackage_Accessor.AttachShadow(this.package).Core.DisplayUI = false; this.taskUnderTest = new ViolationTask_Accessor(this.package, violation); this.taskUnderTestShell = ErrorTask_Accessor.AttachShadow(this.taskUnderTest.Target); }
/// <summary> /// Initializes a new instance of the ViolationTask class. /// </summary> /// <param name="serviceProvider">System service provider.</param> /// <param name="violation">The StyleCop violation that this task represents.</param> internal ViolationTask(IServiceProvider serviceProvider, ViolationInfo violation) { Param.AssertNotNull(serviceProvider, "serviceProvider"); Param.Ignore(violation); this.violation = violation; this.Column = 0; this.Document = violation.File; this.Line = violation.LineNumber - 1; this.Text = violation.Description; this.ErrorCategory = TaskErrorCategory.Warning; StyleCopVSPackage package = serviceProvider.GetService(typeof(StyleCopVSPackage)) as StyleCopVSPackage; Debug.Assert(package != null, "Unable to locate the package"); this.core = package.Core; }
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 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; }
private AnalysisHelper SetCoreNoUI() { StyleCopVSPackage packageAccessor = new StyleCopVSPackage(); packageAccessor.Core.DisplayUI = false; return packageAccessor.Helper; }