public void InspectionName() { const string inspectionName = "OptionBaseZeroInspection"; var inspection = new OptionBaseZeroInspection(null); Assert.AreEqual(inspectionName, inspection.Name); }
public void OptionBaseZeroStatement_QuickFixWorks_RemoveStatement_InstructionSeparatorAndMultipleLines() { string inputCode = @"Option Explicit: Option _ Base _ 0: Option Base 1"; string expectedCode = "Option Explicit: : Option Base 1"; var settings = new Mock <IGeneralConfigService>(); var config = GetTestConfig(); settings.Setup(x => x.LoadConfiguration()).Returns(config); IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new OptionBaseZeroInspection(state); var inspector = new Inspector(settings.Object, new IInspection[] { inspection }); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; inspectionResults.First().QuickFixes.First().Fix(); Assert.AreEqual(expectedCode, component.CodeModule.Content()); }
public void OptionBaseOneStatement_NoResult() { string inputCode = "Option Base 1"; var settings = new Mock <IGeneralConfigService>(); var config = GetTestConfig(); settings.Setup(x => x.LoadConfiguration()).Returns(config); IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new OptionBaseZeroInspection(state); var inspector = new Inspector(settings.Object, new IInspection[] { inspection }); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; Assert.IsFalse(inspectionResults.Any()); }
public void InspectionType() { var inspection = new OptionBaseZeroInspection(null); Assert.AreEqual(CodeInspectionType.MaintainabilityAndReadabilityIssues, inspection.InspectionType); }