diff --git a/src/FluentAssertions.Analyzers.TestUtils/GenerateCode.cs b/src/FluentAssertions.Analyzers.TestUtils/GenerateCode.cs index 76f27020..80e9300b 100644 --- a/src/FluentAssertions.Analyzers.TestUtils/GenerateCode.cs +++ b/src/FluentAssertions.Analyzers.TestUtils/GenerateCode.cs @@ -29,7 +29,6 @@ public static string GenericArrayExpressionBodyAssertion(string assertion) => Ge .AppendLine(" public bool BooleanProperty { get; set; }") .AppendLine(" public string Message { get; set; }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -57,7 +56,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine(" public bool BooleanProperty { get; set; }") .AppendLine(" public string Message { get; set; }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -75,7 +73,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -98,7 +95,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine(" {") .AppendLine(" public bool BooleanProperty { get; set; }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -115,7 +111,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -132,7 +127,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -148,7 +142,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -164,7 +157,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -182,7 +174,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine(" }") .AppendLine(" async void AsyncVoidMethod() { await Task.CompletedTask; }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -199,7 +190,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {statement}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -218,7 +208,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); @@ -240,16 +229,7 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString(); - - public static StringBuilder AppendMainMethod(this StringBuilder builder) => builder - .AppendLine(" class Program") - .AppendLine(" {") - .AppendLine(" public static void Main()") - .AppendLine(" {") - .AppendLine(" }") - .AppendLine(" }"); } } diff --git a/src/FluentAssertions.Analyzers.Tests/DiagnosticVerifier.cs b/src/FluentAssertions.Analyzers.Tests/DiagnosticVerifier.cs index a57085f8..94af20c1 100644 --- a/src/FluentAssertions.Analyzers.Tests/DiagnosticVerifier.cs +++ b/src/FluentAssertions.Analyzers.Tests/DiagnosticVerifier.cs @@ -227,6 +227,7 @@ private static Diagnostic[] GetSortedDiagnosticsFromDocuments(DiagnosticAnalyzer var compilation = project.GetCompilationAsync().Result; var compilationWithAnalyzers = compilation .WithOptions(compilation.Options + .WithOutputKind(OutputKind.DynamicallyLinkedLibrary) .WithSpecificDiagnosticOptions(new Dictionary { ["CS1701"] = ReportDiagnostic.Suppress, // Binding redirects diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs index 5f6ce874..99de7400 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs @@ -38,7 +38,6 @@ public void AssertIsTrue_NestedUsingInNamespace1_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString()); @@ -62,7 +61,6 @@ public void AssertIsTrue_NestedUsingInNamespace2_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString()); @@ -86,7 +84,6 @@ public void AssertIsTrue_NestedUsingInNamespace3_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }}") - .AppendMainMethod() .AppendLine("}") .ToString()); @@ -110,7 +107,6 @@ public void AssertIsTrue_NestedUsingInNamespace4_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }}") - .AppendMainMethod() .AppendLine("}") .ToString()); @@ -134,7 +130,6 @@ public void AssertIsTrue_NestedUsingInNamespace5_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString()); @@ -158,7 +153,6 @@ public void AssertIsTrue_NestedUsingInNamespace6_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString()); @@ -182,7 +176,6 @@ public void AssertIsTrue_NestedUsingInNamespace7_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString()); @@ -206,7 +199,6 @@ public void AssertIsTrue_NestedUsingInNamespace8_TestAnalyzer(string assertion) .AppendLine($" {assertion}") .AppendLine(" }") .AppendLine(" }") - .AppendMainMethod() .AppendLine("}") .ToString());