Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDISP007 lambda disposing injected, not a very useful case. #58

Open
JohanLarsson opened this issue Apr 3, 2018 · 0 comments
Open

IDISP007 lambda disposing injected, not a very useful case. #58

JohanLarsson opened this issue Apr 3, 2018 · 0 comments

Comments

@JohanLarsson
Copy link
Collaborator

        [TestCase("action(disposable)")]
        [TestCase("action.Invoke(disposable)")]
        public void LambdaUsageOnInjected(string disposeCode)
        {
            var testCode = @"
namespace RoslynSandbox
{
    using System;

    public class Foo
    {
        public Foo(IDisposable disposable)
        {
            Action<IDisposable> action = x => x.Dispose();
            ↓action(disposable);
        }
    }
}";
            testCode = testCode.AssertReplace("action(disposable)", disposeCode);
            AnalyzerAssert.Diagnostics(Analyzer, ExpectedDiagnostic, testCode);
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant