Repository: dotnet/roslyn
File: src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs (C#)

Code before:
                    {
                        BlockingCollection<int> bc = [|new|](queue);
                        [|bc.Add(|]42);
                    }
                }
                """,
            FixedCode = """
                using System;
                using System.Collections.Concurrent;

                class A
                {
                    public void Main(ConcurrentQueue<int> queue)
                    {
                        BlockingCollection<int> bc = new(queue)
                        {
                            42
                        };
                    }
                }
                """,
            LanguageVersion = LanguageVersion.CSharp13,
            ReferenceAssemblies = ReferenceAssemblies.Net.Net90,
        }.RunAsync();

    [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/77365")]
    public Task TestDoNotOfferForUsingDeclaration()
        => TestMissingInRegularAndScriptAsync(
            """
            using System;
            using System.Collections;
            using System.Collections.Generic;

            public class DisposableCollection : IEnumerable, IDisposable
            {
                private readonly List<object> _items = new List<object>();
                
                public void Add(object item) => _items.Add(item);
                
                public IEnumerator GetEnumerator() => _items.GetEnumerator();
                
                public void Dispose() { }
            }

            class C
            {
                void M()
                {
                    using var collection = new DisposableCollection();
                    collection.Add(1);
                    collection.Add(2);

Review comment (suggestion):
```suggestion
    [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80862")]
```

Code after:
                    {
                        BlockingCollection<int> bc = [|new|](queue);
                        [|bc.Add(|]42);
                    }
                }
                """,
            FixedCode = """
                using System;
                using System.Collections.Concurrent;

                class A
                {
                    public void Main(ConcurrentQueue<int> queue)
                    {
                        BlockingCollection<int> bc = new(queue)
                        {
                            42
                        };
                    }
                }
                """,
            LanguageVersion = LanguageVersion.CSharp13,
            ReferenceAssemblies = ReferenceAssemblies.Net.Net90,
        }.RunAsync();

    [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80862")]
    public Task TestDoNotOfferForUsingDeclaration()
        => TestMissingInRegularAndScriptAsync(
            """
            using System;
            using System.Collections;
            using System.Collections.Generic;

            public class DisposableCollection : IEnumerable, IDisposable
            {
                private readonly List<object> _items = new List<object>();
                
                public void Add(object item) => _items.Add(item);
                
                public IEnumerator GetEnumerator() => _items.GetEnumerator();
                
                public void Dispose() { }
            }

            class C
            {
                void M()
                {
                    using var collection = new DisposableCollection();
                    collection.Add(1);
                    collection.Add(2);