public void ImplementsInterface() { const string inputCode1 = @"Public Sub Foo() End Sub"; //Expectation const string inputCode2 = @"Implements Class1 Public Sub Class1_Foo() Err.Raise 5 'TODO implement interface member End Sub "; var builder = new MockVbeBuilder(); var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected) .AddComponent("Class1", ComponentType.ClassModule, inputCode1) .AddComponent("Class2", ComponentType.ClassModule, inputCode2) .Build(); var vbe = builder.AddProject(project).Build(); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new UnderscoreInPublicClassModuleMemberInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; Assert.AreEqual(0, inspectionResults.Count()); } }
public void NoUnderscore() { const string inputCode = @"Public Sub Foo() End Sub"; var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out _); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new UnderscoreInPublicClassModuleMemberInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; Assert.AreEqual(0, inspectionResults.Count()); } }
public void BasicExample_Property() { const string inputCode = @"Public Property Get Test_This_Out() As Integer End Property"; var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out _); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new UnderscoreInPublicClassModuleMemberInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; Assert.AreEqual(1, inspectionResults.Count()); } }