public void ObsoleteGlobal_DoesNotReturnResult() { const string inputCode = @"Public var1 As Integer"; //Arrange var builder = new MockVbeBuilder(); VBComponent component; var vbe = builder.BuildFromSingleStandardModule(inputCode, out component); var mockHost = new Mock<IHostApplication>(); mockHost.SetupAllProperties(); var parser = MockParser.Create(vbe.Object, new RubberduckParserState()); parser.Parse(); if (parser.State.Status == ParserState.Error) { Assert.Inconclusive("Parser Error"); } var inspection = new ObsoleteGlobalInspection(parser.State); var inspectionResults = inspection.GetInspectionResults(); Assert.AreEqual(0, inspectionResults.Count()); }
public void InspectionType() { var inspection = new ObsoleteGlobalInspection(null); Assert.AreEqual(CodeInspectionType.LanguageOpportunities, inspection.InspectionType); }
public void InspectionName() { const string inspectionName = "ObsoleteGlobalInspection"; var inspection = new ObsoleteGlobalInspection(null); Assert.AreEqual(inspectionName, inspection.Name); }
public void ObsoleteGlobal_QuickFixWorks() { const string inputCode = @"Global var1 As Integer"; const string expectedCode = @"Public var1 As Integer"; //Arrange var builder = new MockVbeBuilder(); VBComponent component; var vbe = builder.BuildFromSingleStandardModule(inputCode, out component); var project = vbe.Object.VBProjects.Item(0); var module = project.VBComponents.Item(0).CodeModule; var mockHost = new Mock<IHostApplication>(); mockHost.SetupAllProperties(); var parser = MockParser.Create(vbe.Object, new RubberduckParserState()); parser.Parse(); if (parser.State.Status == ParserState.Error) { Assert.Inconclusive("Parser Error"); } var inspection = new ObsoleteGlobalInspection(parser.State); var inspectionResults = inspection.GetInspectionResults(); inspectionResults.First().QuickFixes.First().Fix(); Assert.AreEqual(expectedCode, module.Lines()); }