From 401db5d23d439e64070ebe1a21992ffd08dcbfdd Mon Sep 17 00:00:00 2001 From: Meir Blachman Date: Sun, 20 Aug 2023 18:46:11 +0300 Subject: [PATCH] reproduce flow with failing test --- .../Tips/SanityTests.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/SanityTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/SanityTests.cs index 216271cb..d6374d93 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/SanityTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/SanityTests.cs @@ -314,5 +314,37 @@ public static void True(bool input) Locations = new[] { new DiagnosticResultLocation("Test0.cs", 7, 9) } }); } + + [TestMethod] + [Implemented(Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/207")] + public void PropertiesOfTypes() + { + const string globalUsings = @" +global using Xunit; +global using FluentAssertions; +global using FluentAssertions.Extensions;"; + const string source = @" +public class TestClass +{ + public static void Main() + { + var x = new TestType(); + x.List.Any().Should().BeTrue(); + } +} + +public class TestType +{ + public List List { get; set; } +}"; + + DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(new[] { source, globalUsings }, new DiagnosticResult() + { + Id = AssertTrueAnalyzer.DiagnosticId, + Message = AssertTrueAnalyzer.Message, + Severity = DiagnosticSeverity.Info, + Locations = new[] { new DiagnosticResultLocation("Test0.cs", 7, 9) } + }); + } } } \ No newline at end of file