public void When_TheVisitMethod_Is_Invoked_And_TheXUnitTheoryToAnalyze_IsEmpty() { // ARRANGE const string sourceCodeFileToAnalyze = @" public class SomeClassToAnalyze { [Theory] [InlineData(1)] public void SomeTestMethod(int someInlineIntegerData) { } }"; CompilationUnitSyntax compUnitSyntax = UnitTestUtilities.GetAMethodDeclarationSyntaxFromSourceCode(sourceCodeFileToAnalyze); CSharpUnitTestLintWalker classUnderTest = new CSharpUnitTestLintWalker(new UnitTestViolations()); // ACT classUnderTest.Visit(compUnitSyntax); // ASSERT classUnderTest.EnhancedDiagnostics .Count .Should().Be(UnitTestUtilities.ZeroEnhancedDiagnostics); }
public void When_TheVisitMethod_Is_Invoked_And_TheNUnitTheoryToAnalyze_IsEmpty() { // ARRANGE const string sourceCodeFileToAnalyze = @" public class SomeClassToAnalyze { [DatapointSource] public double[] values = new double[] { 0.0, 1.0, -1.0, 42.0 }; [Theory] public void SomeTestMethod(int someDouble) { } }"; CompilationUnitSyntax compUnitSyntax = UnitTestUtilities.GetAMethodDeclarationSyntaxFromSourceCode(sourceCodeFileToAnalyze); CSharpUnitTestLintWalker classUnderTest = new CSharpUnitTestLintWalker(new UnitTestViolations()); // ACT classUnderTest.Visit(compUnitSyntax); // ASSERT classUnderTest.EnhancedDiagnostics .Count .Should().Be(UnitTestUtilities.ZeroEnhancedDiagnostics); }
public void When_TheVisitMethod_Is_Invoked_And_TheNUnitTestCaseSourceToAnalyze_IsEmpty() { // ARRANGE const string sourceCodeFileToAnalyze = @" public class SomeClassToAnalyze { [TestCaseSource(""SomeCases"")] public void SomeTestMethod(int someInt) { } static object[] SomeCases = { new object[] { 1}, new object[] { 2 }, new object[] { 3 } }; }"; CompilationUnitSyntax compUnitSyntax = UnitTestUtilities.GetAMethodDeclarationSyntaxFromSourceCode(sourceCodeFileToAnalyze); CSharpUnitTestLintWalker classUnderTest = new CSharpUnitTestLintWalker(new UnitTestViolations()); // ACT classUnderTest.Visit(compUnitSyntax); // ASSERT classUnderTest.EnhancedDiagnostics .Count .Should().Be(UnitTestUtilities.ZeroEnhancedDiagnostics); }
public void When_TheVisitMethod_Is_Invoked_And_TheMethodToAnalyze_IsNotATestMethod_ButHasRuleViolations() { // ARRANGE CompilationUnitSyntax compUnitSyntax = UnitTestUtilities.GetAMethodDeclarationSyntaxFromSourceCode( UnitTestUtilities.SourceFileWithAllViolationsButNoTests); CSharpUnitTestLintWalker classUnderTest = new CSharpUnitTestLintWalker(new UnitTestViolations()); // ACT classUnderTest.Visit(compUnitSyntax); // ASSERT classUnderTest.EnhancedDiagnostics .Count .Should().Be(UnitTestUtilities.ZeroEnhancedDiagnostics); }