Skip to content

Commit

Permalink
tests: generate test project as DynamicallyLinkedLibrary (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meir017 authored Dec 19, 2023
1 parent 593b7b8 commit 5f1e37d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
20 changes: 0 additions & 20 deletions src/FluentAssertions.Analyzers.TestUtils/GenerateCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand All @@ -75,7 +73,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -98,7 +95,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine(" {")
.AppendLine(" public bool BooleanProperty { get; set; }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -115,7 +111,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -132,7 +127,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -148,7 +142,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -164,7 +157,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -182,7 +174,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine(" }")
.AppendLine(" async void AsyncVoidMethod() { await Task.CompletedTask; }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -199,7 +190,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine($" {statement}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -218,7 +208,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString();

Expand All @@ -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(" }");
}
}
1 change: 1 addition & 0 deletions src/FluentAssertions.Analyzers.Tests/DiagnosticVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, ReportDiagnostic>
{
["CS1701"] = ReportDiagnostic.Suppress, // Binding redirects
Expand Down
8 changes: 0 additions & 8 deletions src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public void AssertIsTrue_NestedUsingInNamespace1_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand All @@ -62,7 +61,6 @@ public void AssertIsTrue_NestedUsingInNamespace2_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand All @@ -86,7 +84,6 @@ public void AssertIsTrue_NestedUsingInNamespace3_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }}")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand All @@ -110,7 +107,6 @@ public void AssertIsTrue_NestedUsingInNamespace4_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }}")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand All @@ -134,7 +130,6 @@ public void AssertIsTrue_NestedUsingInNamespace5_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand All @@ -158,7 +153,6 @@ public void AssertIsTrue_NestedUsingInNamespace6_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand All @@ -182,7 +176,6 @@ public void AssertIsTrue_NestedUsingInNamespace7_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand All @@ -206,7 +199,6 @@ public void AssertIsTrue_NestedUsingInNamespace8_TestAnalyzer(string assertion)
.AppendLine($" {assertion}")
.AppendLine(" }")
.AppendLine(" }")
.AppendMainMethod()
.AppendLine("}")
.ToString());

Expand Down

0 comments on commit 5f1e37d

Please sign in to comment.