File tree Expand file tree Collapse file tree
tests/DataverseAnalyzer.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 <None Include =" ..\..\LICENSE.md" Pack =" true" PackagePath =" LICENSE.md" />
3030 </ItemGroup >
3131
32+ <ItemGroup >
33+ <None Include =" bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).dll" Pack =" true" PackagePath =" analyzers\dotnet\cs\$(AssemblyName).dll" Visible =" false" />
34+ </ItemGroup >
35+
3236 <PropertyGroup >
3337 <EnableDefaultEmbeddedResourceItems >false</EnableDefaultEmbeddedResourceItems >
3438 </PropertyGroup >
Original file line number Diff line number Diff line change @@ -185,6 +185,27 @@ private void DoSomething() { }
185185 Assert . Empty ( diagnostics ) ;
186186 }
187187
188+ [ Fact ]
189+ public async Task IfStatementWithAssignmentShouldTrigger ( )
190+ {
191+ var source = """
192+ class TestClass
193+ {
194+ public void TestMethod()
195+ {
196+ var bla = string.Empty;
197+
198+ if (true)
199+ bla = "bla";
200+ }
201+ }
202+ """ ;
203+
204+ var diagnostics = await GetDiagnosticsAsync ( source ) ;
205+ Assert . Single ( diagnostics ) ;
206+ Assert . Equal ( "CT0001" , diagnostics [ 0 ] . Id ) ;
207+ }
208+
188209 private static async Task < Diagnostic [ ] > GetDiagnosticsAsync ( string source )
189210 {
190211 var syntaxTree = CSharpSyntaxTree . ParseText ( source ) ;
You can’t perform that action at this time.
0 commit comments