Skip to content

Commit 6b87da0

Browse files
committed
added more tests for NullConditionalAssertionAnalyzer
1 parent 5a86695 commit 6b87da0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/FluentAssertions.Analyzers.Tests/Tips/NullConditionalAssertionTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public class NullConditionalAssertionTests
99
{
1010
[AssertionDataTestMethod]
1111
[AssertionDiagnostic("actual?.Should().Be(expected{0});")]
12+
[AssertionDiagnostic("actual?.MyProperty.Should().Be(\"test\"{0});")]
13+
[AssertionDiagnostic("actual.MyProperty?.Should().Be(\"test\"{0});")]
1214
[Implemented]
1315
public void TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion);
1416

@@ -21,11 +23,15 @@ private void VerifyCSharpDiagnostic(string assertion)
2123
.AppendLine("{")
2224
.AppendLine(" class TestClass")
2325
.AppendLine(" {")
24-
.AppendLine(" void TestMethod(int? actual, int expected)")
26+
.AppendLine(" void TestMethod(MyClass actual, MyClass expected)")
2527
.AppendLine(" {")
2628
.AppendLine($" {assertion}")
2729
.AppendLine(" }")
2830
.AppendLine(" }")
31+
.AppendLine(" class MyClass")
32+
.AppendLine(" {")
33+
.AppendLine(" public string MyProperty { get; set; }")
34+
.AppendLine(" }")
2935
.AppendLine(" class Program")
3036
.AppendLine(" {")
3137
.AppendLine(" public static void Main()")

0 commit comments

Comments
 (0)