Skip to content

Commit 7d07dbd

Browse files
MafiiJohanLarsson
authored andcommitted
Add reproduction test
1 parent 12c6ff6 commit 7d07dbd

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

IDisposableAnalyzers.Test/IDISP001DisposeCreatedTests/Valid.Ignore.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,34 @@ public C(IKernel kernel)
7171
}";
7272
RoslynAssert.Valid(Analyzer, code);
7373
}
74+
75+
[Test]
76+
public static void ReactiveUiDisposeWith()
77+
{
78+
const string Code = """
79+
namespace N
80+
{
81+
using System;
82+
using System.Reactive.Disposables;
83+
using ReactiveUI;
84+
85+
public sealed class C : IDisposable
86+
{
87+
private readonly CompositeDisposable _disposables = new();
88+
89+
public C()
90+
{
91+
var command = ReactiveCommand.Create(() => { Console.WriteLine("Hi"); }).DisposeWith(_disposables);
92+
}
93+
94+
public void Dispose()
95+
{
96+
_disposables.Dispose();
97+
}
98+
}
99+
}
100+
""";
101+
102+
RoslynAssert.Valid(Analyzer, Code);
103+
}
74104
}

0 commit comments

Comments
 (0)