SemanticQuickInfoSourceTests.cs 125.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Linq;
using System.Security;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Editor.CSharp.QuickInfo;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Projection;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QuickInfo
{
    public class SemanticQuickInfoSourceTests : AbstractSemanticQuickInfoSourceTests
    {
        private void TestWithOptions(CSharpParseOptions options, string markup, params Action<object>[] expectedResults)
        {
            using (var workspace = CSharpWorkspaceFactory.CreateWorkspaceFromFile(markup, options))
            {
                var position = workspace.Documents.Single().CursorPosition.Value;

                var noListeners = SpecializedCollections.EmptyEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>>();

                var provider = new SemanticQuickInfoProvider(
                    workspace.GetService<ITextBufferFactoryService>(),
                    workspace.GetService<IContentTypeRegistryService>(),
                    workspace.GetService<IProjectionBufferFactoryService>(),
                    workspace.GetService<IEditorOptionsFactoryService>(),
                    workspace.GetService<ITextEditorFactoryService>(),
                    workspace.GetService<IGlyphService>(),
                    workspace.GetService<ClassificationTypeMap>());

                TestWithOptions(workspace, provider, position, expectedResults);

                // speculative semantic model
                var document = workspace.CurrentSolution.Projects.First().Documents.First();
                if (CanUseSpeculativeSemanticModel(document, position))
                {
                    var buffer = workspace.Documents.Single().TextBuffer;
                    using (var edit = buffer.CreateEdit())
                    {
                        edit.Replace(0, buffer.CurrentSnapshot.Length, buffer.CurrentSnapshot.GetText());
                        edit.Apply();
                    }

                    TestWithOptions(workspace, provider, position, expectedResults);
                }
            }
        }

        private void TestWithOptions(TestWorkspace workspace, SemanticQuickInfoProvider provider, int position, Action<object>[] expectedResults)
        {
            var document = workspace.CurrentSolution.Projects.First().Documents.First();
            var state = provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None).Result;
            if (state != null)
            {
                WaitForDocumentationComment(state.Content);
            }

            if (expectedResults.Length == 0)
            {
                Assert.Null(state);
            }
            else
            {
                Assert.NotNull(state);

                foreach (var expected in expectedResults)
                {
                    expected(state.Content);
                }
            }
        }

        private void VerifyWithMscorlib45(string markup, Action<object>[] expectedResults)
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""C#"" CommonReferencesNet45=""true"">
        <Document FilePath=""SourceDocument"">
{0}
        </Document>
    </Project>
</Workspace>", SecurityElement.Escape(markup));

            using (var workspace = TestWorkspaceFactory.CreateWorkspace(xmlString))
            {
                var position = workspace.Documents.Single(d => d.Name == "SourceDocument").CursorPosition.Value;
                var documentId = workspace.Documents.Where(d => d.Name == "SourceDocument").Single().Id;
                var document = workspace.CurrentSolution.GetDocument(documentId);

                var provider = new SemanticQuickInfoProvider(
                        workspace.GetService<ITextBufferFactoryService>(),
                        workspace.GetService<IContentTypeRegistryService>(),
                        workspace.GetService<IProjectionBufferFactoryService>(),
                        workspace.GetService<IEditorOptionsFactoryService>(),
                        workspace.GetService<ITextEditorFactoryService>(),
                        workspace.GetService<IGlyphService>(),
                        workspace.GetService<ClassificationTypeMap>());

                var state = provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None).Result;
                if (state != null)
                {
                    WaitForDocumentationComment(state.Content);
                }

                if (expectedResults.Length == 0)
                {
                    Assert.Null(state);
                }
                else
                {
                    Assert.NotNull(state);

                    foreach (var expected in expectedResults)
                    {
                        expected(state.Content);
                    }
                }
            }
        }

        protected override void Test(string markup, params Action<object>[] expectedResults)
        {
            TestWithOptions(Options.Regular, markup, expectedResults);
            TestWithOptions(Options.Script, markup, expectedResults);
        }

        protected void TestWithUsings(string markup, params Action<object>[] expectedResults)
        {
            var markupWithUsings =
@"using System;
using System.Collections.Generic;
using System.Linq;
" + markup;

            Test(markupWithUsings, expectedResults);
        }

        protected void TestInClass(string markup, params Action<object>[] expectedResults)
        {
            var markupInClass = "class C { " + markup + " }";
            TestWithUsings(markupInClass, expectedResults);
        }

        protected void TestInMethod(string markup, params Action<object>[] expectedResults)
        {
            var markupInMethod = "class C { void M() { " + markup + " } }";
            TestWithUsings(markupInMethod, expectedResults);
        }

        private void TestWithReference(string sourceCode,
            string referencedCode,
            string sourceLanguage,
            string referencedLanguage,
            params Action<object>[] expectedResults)
        {
            TestWithMetadataReferenceHelper(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults);
            TestWithProjectReferenceHelper(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults);

            // Multi-language projects are not supported.
            if (sourceLanguage == referencedLanguage)
            {
                TestInSameProjectHelper(sourceCode, referencedCode, sourceLanguage, expectedResults);
            }
        }

        private void TestWithMetadataReferenceHelper(
            string sourceCode,
            string referencedCode,
            string sourceLanguage,
            string referencedLanguage,
            params Action<object>[] expectedResults)
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""{0}"" CommonReferences=""true"">
        <Document FilePath=""SourceDocument"">
{1}
        </Document>
        <MetadataReferenceFromSource Language=""{2}"" CommonReferences=""true"" IncludeXmlDocComments=""true"">
            <Document FilePath=""ReferencedDocument"">
{3}
            </Document>
        </MetadataReferenceFromSource>
    </Project>
</Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode),
               referencedLanguage, SecurityElement.Escape(referencedCode));

            VerifyWithReferenceWorker(xmlString, expectedResults);
        }

        private void TestWithProjectReferenceHelper(
            string sourceCode,
            string referencedCode,
            string sourceLanguage,
            string referencedLanguage,
            params Action<object>[] expectedResults)
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""{0}"" CommonReferences=""true"">
        <ProjectReference>ReferencedProject</ProjectReference>
        <Document FilePath=""SourceDocument"">
{1}
        </Document>
    </Project>
    <Project Language=""{2}"" CommonReferences=""true"" AssemblyName=""ReferencedProject"">
        <Document FilePath=""ReferencedDocument"">
{3}
        </Document>
    </Project>
    
</Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode),
               referencedLanguage, SecurityElement.Escape(referencedCode));

            VerifyWithReferenceWorker(xmlString, expectedResults);
        }

        private void TestInSameProjectHelper(
            string sourceCode,
            string referencedCode,
            string sourceLanguage,
            params Action<object>[] expectedResults)
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""{0}"" CommonReferences=""true"">
        <Document FilePath=""SourceDocument"">
{1}
        </Document>
        <Document FilePath=""ReferencedDocument"">
{2}
        </Document>
    </Project>
</Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), SecurityElement.Escape(referencedCode));

            VerifyWithReferenceWorker(xmlString, expectedResults);
        }

        private void VerifyWithReferenceWorker(string xmlString, params Action<object>[] expectedResults)
        {
            using (var workspace = TestWorkspaceFactory.CreateWorkspace(xmlString))
            {
                var position = workspace.Documents.First(d => d.Name == "SourceDocument").CursorPosition.Value;
                var documentId = workspace.Documents.First(d => d.Name == "SourceDocument").Id;
                var document = workspace.CurrentSolution.GetDocument(documentId);

                var provider = new SemanticQuickInfoProvider(
                        workspace.GetService<ITextBufferFactoryService>(),
                        workspace.GetService<IContentTypeRegistryService>(),
                        workspace.GetService<IProjectionBufferFactoryService>(),
                        workspace.GetService<IEditorOptionsFactoryService>(),
                        workspace.GetService<ITextEditorFactoryService>(),
                        workspace.GetService<IGlyphService>(),
                        workspace.GetService<ClassificationTypeMap>());

                var state = provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None).Result;
                if (state != null)
                {
                    WaitForDocumentationComment(state.Content);
                }

                if (expectedResults.Length == 0)
                {
                    Assert.Null(state);
                }
                else
                {
                    Assert.NotNull(state);

                    foreach (var expected in expectedResults)
                    {
                        expected(state.Content);
                    }
                }
            }
        }

        protected void TestInvalidTypeInClass(string code)
        {
            var codeInClass = "class C { " + code + " }";
            Test(codeInClass);
        }

296
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
297 298 299 300 301 302
        public void TestNamespaceInUsingDirective()
        {
            Test("using $$System;",
                MainDescription("namespace System"));
        }

303
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
304 305 306 307 308 309
        public void TestNamespaceInUsingDirective2()
        {
            Test("using System.Coll$$ections.Generic;",
                MainDescription("namespace System.Collections"));
        }

310
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
311 312 313 314 315 316
        public void TestNamespaceInUsingDirective3()
        {
            Test("using System.L$$inq;",
                MainDescription("namespace System.Linq"));
        }

317
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
318 319 320 321 322 323
        public void TestNamespaceInUsingDirectiveWithAlias()
        {
            Test("using Foo = Sys$$tem.Console;",
                MainDescription("namespace System"));
        }

324
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
325 326 327 328 329 330 331
        public void TestTypeInUsingDirectiveWithAlias()
        {
            Test("using Foo = System.Con$$sole;",
                MainDescription("class System.Console"));
        }

        [WorkItem(991466)]
332
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
333 334 335 336 337 338 339 340 341 342 343 344 345
        public void TestDocumentationInUsingDirectiveWithAlias()
        {
            var markup =
@"using I$$ = IFoo;
///<summary>summary for interface IFoo</summary>
interface IFoo {  }";

            Test(markup,
                MainDescription("interface IFoo"),
                Documentation("summary for interface IFoo"));
        }

        [WorkItem(991466)]
346
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
347 348 349 350 351 352 353 354 355 356 357 358 359 360
        public void TestDocumentationInUsingDirectiveWithAlias2()
        {
            var markup =
@"using I = IFoo;
///<summary>summary for interface IFoo</summary>
interface IFoo {  }
class C : I$$ { }";

            Test(markup,
                MainDescription("interface IFoo"),
                Documentation("summary for interface IFoo"));
        }

        [WorkItem(991466)]
361
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
        public void TestDocumentationInUsingDirectiveWithAlias3()
        {
            var markup =
@"using I = IFoo;
///<summary>summary for interface IFoo</summary>
interface IFoo 
{  
    void Foo();
}
class C : I$$ { }";

            Test(markup,
                MainDescription("interface IFoo"),
                Documentation("summary for interface IFoo"));
        }

378
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
379 380 381 382 383 384 385 386 387 388 389 390
        public void TestThis()
        {
            var markup =
@"
///<summary>summary for Class C</summary>
class C { string M() {  return thi$$s.ToString(); } }";

            TestWithUsings(markup,
                MainDescription("class C"),
                Documentation("summary for Class C"));
        }

391
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
392 393 394 395 396 397 398 399 400 401 402 403
        public void TestClassWithDocComment()
        {
            var markup =
@"
///<summary>Hello!</summary>
class C { void M() { $$C obj; } }";

            Test(markup,
                MainDescription("class C"),
                Documentation("Hello!"));
        }

404
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
        public void TestSingleLineDocComments()
        {
            // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedSingleLineComment

            // SingleLine doc comment with leading whitespace
            Test(@"
    ///<summary>Hello!</summary>
    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with space before opening tag
            Test(@"
/// <summary>Hello!</summary>
class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with space before opening tag and leading whitespace
            Test(@"
    /// <summary>Hello!</summary>
    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with leading whitespace and blank line
            Test(@"
    ///<summary>Hello!
    ///</summary>

    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with '\r' line separators
            Test("///<summary>Hello!\r///</summary>\rclass C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));
        }

445
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
        public void TestMultiLineDocComments()
        {
            // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedMultiLineComment

            // Multiline doc comment with leading whitespace
            Test(@"
    /**<summary>Hello!</summary>*/
    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with space before opening tag
            Test(@"
/** <summary>Hello!</summary>
 **/
class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with space before opening tag and leading whitespace
            Test(@"
    /**
     ** <summary>Hello!</summary>
     **/
    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with no per-line prefix
            Test(@"
/**
  <summary>
  Hello!
  </summary>
*/
    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with inconsistent per-line prefix
            Test(@"
/**
 ** <summary>
    Hello!</summary>
 **
 **/
    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with closing comment on final line
            Test(@"
/**
<summary>Hello!
</summary>*/
    class C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with '\r' line separators
            Test("/**\r* <summary>\r* Hello!\r* </summary>\r*/\rclass C { void M() { $$C obj; } }",
                MainDescription("class C"),
                Documentation("Hello!"));
        }

511
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
512 513 514 515 516 517 518 519 520 521 522 523
        public void TestMethodWithDocComment()
        {
            var markup =
@"
///<summary>Hello!</summary>
void M() { M$$() }";

            TestInClass(markup,
                MainDescription("void C.M()"),
                Documentation("Hello!"));
        }

524
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
525 526 527 528 529 530
        public void TestInt32()
        {
            TestInClass(@"$$Int32 i;",
                MainDescription("struct System.Int32"));
        }

531
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
532 533 534 535 536 537
        public void TestBuiltInInt()
        {
            TestInClass(@"$$int i;",
                MainDescription("struct System.Int32"));
        }

538
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
539 540 541 542 543 544
        public void TestString()
        {
            TestInClass(@"$$String s;",
                MainDescription("class System.String"));
        }

545
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
546 547 548 549 550 551
        public void TestBuiltInString()
        {
            TestInClass(@"$$string s;",
                MainDescription("class System.String"));
        }

552
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
553 554 555 556 557 558
        public void TestBuiltInStringAtEndOfToken()
        {
            TestInClass(@"string$$ s;",
                MainDescription("class System.String"));
        }

559
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
560 561 562 563 564 565
        public void TestBoolean()
        {
            TestInClass(@"$$Boolean b;",
                MainDescription("struct System.Boolean"));
        }

566
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
567 568 569 570 571 572
        public void TestBuiltInBool()
        {
            TestInClass(@"$$bool b;",
                MainDescription("struct System.Boolean"));
        }

573
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
574 575 576 577 578 579
        public void TestSingle()
        {
            TestInClass(@"$$Single s;",
                MainDescription("struct System.Single"));
        }

580
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
581 582 583 584 585 586
        public void TestBuiltInFloat()
        {
            TestInClass(@"$$float f;",
                MainDescription("struct System.Single"));
        }

587
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
588 589 590 591 592
        public void TestVoidIsInvalid()
        {
            TestInvalidTypeInClass(@"$$void M() { }");
        }

593
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
594 595 596 597 598
        public void TestInvalidPointer1_931958()
        {
            TestInvalidTypeInClass(@"$$T* i;");
        }

599
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
600 601 602 603 604
        public void TestInvalidPointer2_931958()
        {
            TestInvalidTypeInClass(@"T$$* i;");
        }

605
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
606 607 608 609 610
        public void TestInvalidPointer3_931958()
        {
            TestInvalidTypeInClass(@"T*$$ i;");
        }

611
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
612 613 614 615
        public void TestListOfString()
        {
            TestInClass(@"$$List<string> l;",
                MainDescription("class System.Collections.Generic.List<T>"),
616
                TypeParameterMap($"\r\nT {FeaturesResources.Is} string"));
617 618
        }

619
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
620 621 622 623 624 625 626 627 628 629
        public void TestListOfSomethingFromSource()
        {
            var markup =
@"
///<summary>Generic List</summary>
public class GenericList<T> { Generic$$List<int> t; }";

            Test(markup,
                MainDescription("class GenericList<T>"),
                Documentation("Generic List"),
630
                TypeParameterMap($"\r\nT {FeaturesResources.Is} int"));
631 632
        }

633
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
634 635 636 637 638 639
        public void TestListOfT()
        {
            TestWithUsings(@"class C<T> { $$List<T> l; }",
                MainDescription("class System.Collections.Generic.List<T>"));
        }

640
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
641 642 643 644 645
        public void TestDictionaryOfIntAndString()
        {
            TestInClass(@"$$Dictionary<int, string> d;",
                MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"),
                TypeParameterMap(
646 647
                    Lines($"\r\nTKey {FeaturesResources.Is} int",
                          $"TValue {FeaturesResources.Is} string")));
648 649
        }

650
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
651 652 653 654 655
        public void TestDictionaryOfTAndU()
        {
            TestWithUsings(@"class C<T, U> { $$Dictionary<T, U> d; }",
                MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"),
                TypeParameterMap(
656 657
                    Lines($"\r\nTKey {FeaturesResources.Is} T",
                          $"TValue {FeaturesResources.Is} U")));
658 659
        }

660
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
661 662 663 664
        public void TestIEnumerableOfInt()
        {
            TestInClass(@"$$IEnumerable<int> M() { yield break; }",
                MainDescription("interface System.Collections.Generic.IEnumerable<out T>"),
665
                TypeParameterMap($"\r\nT {FeaturesResources.Is} int"));
666 667
        }

668
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
669 670 671 672 673 674
        public void TestEventHandler()
        {
            TestInClass(@"event $$EventHandler e;",
                MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)"));
        }

675
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
676 677 678
        public void TestTypeParameter()
        {
            Test(@"class C<T> { $$T t; }",
679
                MainDescription($"T {FeaturesResources.In} C<T>"));
680 681 682
        }

        [WorkItem(538636)]
683
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
684 685 686 687 688 689 690 691 692
        public void TestTypeParameterWithDocComment()
        {
            var markup =
@"
///<summary>Hello!</summary>
///<typeparam name=""T"">T is Type Parameter</typeparam>
class C<T> { $$T t; }";

            Test(markup,
693
                MainDescription($"T {FeaturesResources.In} C<T>"),
694 695 696
                Documentation("T is Type Parameter"));
        }

697
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
698 699 700
        public void TestTypeParameter1_Bug931949()
        {
            Test(@"class T1<T11> { $$T11 t; }",
701
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
702 703
        }

704
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
705 706 707
        public void TestTypeParameter2_Bug931949()
        {
            Test(@"class T1<T11> { T$$11 t; }",
708
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
709 710
        }

711
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
712 713 714
        public void TestTypeParameter3_Bug931949()
        {
            Test(@"class T1<T11> { T1$$1 t; }",
715
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
716 717
        }

718
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
719 720 721
        public void TestTypeParameter4_Bug931949()
        {
            Test(@"class T1<T11> { T11$$ t; }",
722
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
723 724
        }

725
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
726 727 728 729
        public void TestNullableOfInt()
        {
            TestInClass(@"$$Nullable<int> i; }",
                MainDescription("struct System.Nullable<T> where T : struct"),
730
                TypeParameterMap($"\r\nT {FeaturesResources.Is} int"));
731 732
        }

733
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
734 735 736
        public void TestGenericTypeDeclaredOnMethod1_Bug1946()
        {
            Test(@"class C { static void Meth1<T1>($$T1 i) where T1 : struct { T1 i; } }",
737
                MainDescription($"T1 {FeaturesResources.In} C.Meth1<T1> where T1 : struct"));
738 739
        }

740
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
741 742 743
        public void TestGenericTypeDeclaredOnMethod2_Bug1946()
        {
            Test(@"class C { static void Meth1<T1>(T1 i) where $$T1 : struct { T1 i; } }",
744
                MainDescription($"T1 {FeaturesResources.In} C.Meth1<T1> where T1 : struct"));
745 746
        }

747
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
748 749 750
        public void TestGenericTypeDeclaredOnMethod3_Bug1946()
        {
            Test(@"class C { static void Meth1<T1>(T1 i) where T1 : struct { $$T1 i; } }",
751
                MainDescription($"T1 {FeaturesResources.In} C.Meth1<T1> where T1 : struct"));
752 753
        }

754
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
755 756 757
        public void TestGenericTypeParameterConstraint_Class()
        {
            Test(@"class C<T> where $$T : class { }",
758
                MainDescription($"T {FeaturesResources.In} C<T> where T : class"));
759 760
        }

761
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
762 763 764
        public void TestGenericTypeParameterConstraint_Struct()
        {
            Test(@"struct S<T> where $$T : class { }",
765
                MainDescription($"T {FeaturesResources.In} S<T> where T : class"));
766 767
        }

768
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
769 770 771
        public void TestGenericTypeParameterConstraint_Interface()
        {
            Test(@"interface I<T> where $$T : class { }",
772
                MainDescription($"T {FeaturesResources.In} I<T> where T : class"));
773 774
        }

775
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
776 777 778
        public void TestGenericTypeParameterConstraint_Delegate()
        {
            Test(@"delegate void D<T>() where $$T : class;",
779
                MainDescription($"T {FeaturesResources.In} D<T> where T : class"));
780 781
        }

782
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
783 784 785
        public void TestMinimallyQualifiedConstraint()
        {
            Test(@"class C<T> where $$T : IEnumerable<int>",
786
                MainDescription($"T {FeaturesResources.In} C<T> where T : IEnumerable<int>"));
787 788
        }

789
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
790 791 792
        public void FullyQualifiedConstraint()
        {
            Test(@"class C<T> where $$T : System.Collections.Generic.IEnumerable<int>",
793
                MainDescription($"T {FeaturesResources.In} C<T> where T : System.Collections.Generic.IEnumerable<int>"));
794 795
        }

796
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
797 798 799 800 801 802
        public void TestMethodReferenceInSameMethod()
        {
            Test("class C { void M() { M$$(); } }",
                MainDescription("void C.M()"));
        }

803
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
804 805 806 807 808 809 810 811 812 813 814 815
        public void TestMethodReferenceInSameMethodWithDocComment()
        {
            var markup =
@"
///<summary>Hello World</summary>
void M() { M$$(); }";

            TestInClass(markup,
                MainDescription("void C.M()"),
                Documentation("Hello World"));
        }

816
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
817 818 819 820 821 822 823 824 825 826 827
        public void TestFieldInMethodBuiltIn()
        {
            var markup =
@"int field;

void M()
{
    field$$
}";

            TestInClass(markup,
828
                MainDescription($"({FeaturesResources.Field}) int C.field"));
829 830
        }

831
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
832 833 834
        public void TestFieldInMethodBuiltIn2()
        {
            TestInClass("int field; void M() { int f = field$$; }",
835
                MainDescription($"({FeaturesResources.Field}) int C.field"));
836 837
        }

838
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
839 840 841 842 843
        public void TestFieldInMethodBuiltInWithFieldInitializer()
        {
            TestInClass("int field = 1; void M() { int f = field $$; }");
        }

844
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
845 846 847 848 849 850
        public void TestOperatorBuiltIn()
        {
            TestInMethod("int x; x = x$$+1;",
                MainDescription("int int.operator +(int left, int right)"));
        }

851
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
852 853 854
        public void TestOperatorBuiltIn1()
        {
            TestInMethod("int x; x = x$$ + 1;",
855
                MainDescription($"({FeaturesResources.LocalVariable}) int x"));
856 857
        }

858
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
859 860 861
        public void TestOperatorBuiltIn2()
        {
            TestInMethod("int x; x = x+$$x;",
862
                MainDescription($"({FeaturesResources.LocalVariable}) int x"));
863 864
        }

865
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
866 867 868 869 870 871
        public void TestOperatorBuiltIn3()
        {
            TestInMethod("int x; x = x +$$ x;",
                MainDescription("int int.operator +(int left, int right)"));
        }

872
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
873 874 875
        public void TestOperatorBuiltIn4()
        {
            TestInMethod("int x; x = x + $$x;",
876
                MainDescription($"({FeaturesResources.LocalVariable}) int x"));
877 878
        }

879
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
880 881 882 883 884 885 886 887 888 889 890
        public void TestOperatorCustomTypeBuiltIn()
        {
            var markup =
@"class C
{
    static void M() { C c; c = c +$$ c; }
}";

            Test(markup);
        }

891
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
892 893 894 895 896 897 898 899 900 901 902 903 904
        public void TestOperatorCustomTypeOverload()
        {
            var markup =
@"class C
{
    static void M() { C c; c = c +$$ c; }
    static C operator+(C a, C b) { return a; }
}";

            Test(markup,
                MainDescription("C C.operator +(C a, C b)"));
        }

905
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
906 907 908 909 910 911 912 913 914 915 916
        public void TestFieldInMethodMinimal()
        {
            var markup =
@"DateTime field;

void M()
{
    field$$
}";

            TestInClass(markup,
917
                MainDescription($"({FeaturesResources.Field}) DateTime C.field"));
918 919
        }

920
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
921 922 923 924 925 926 927 928 929 930 931
        public void TestFieldInMethodQualified()
        {
            var markup =
@"System.IO.FileInfo file;

void M()
{
    file$$
}";

            TestInClass(markup,
932
                MainDescription($"({FeaturesResources.Field}) System.IO.FileInfo C.file"));
933 934
        }

935
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
936 937 938 939 940 941 942 943
        public void TestMemberOfStructFromSource()
        {
            var markup =
@"struct MyStruct {
public static int SomeField; }
static class Test { int a = MyStruct.Some$$Field; }";

            Test(markup,
944
                MainDescription($"({FeaturesResources.Field}) int MyStruct.SomeField"));
945 946 947
        }

        [WorkItem(538638)]
948
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
949 950 951 952 953 954 955 956 957
        public void TestMemberOfStructFromSourceWithDocComment()
        {
            var markup =
@"struct MyStruct {
///<summary>My Field</summary>
public static int SomeField; }
static class Test { int a = MyStruct.Some$$Field; }";

            Test(markup,
958
                MainDescription($"({FeaturesResources.Field}) int MyStruct.SomeField"),
959 960 961
                Documentation("My Field"));
        }

962
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
963 964 965 966 967 968 969 970
        public void TestMemberOfStructInsideMethodFromSource()
        {
            var markup =
@"struct MyStruct {
public static int SomeField; }
static class Test { static void Method() { int a = MyStruct.Some$$Field; } }";

            Test(markup,
971
                MainDescription($"({FeaturesResources.Field}) int MyStruct.SomeField"));
972 973 974
        }

        [WorkItem(538638)]
975
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
976 977 978 979 980 981 982 983 984
        public void TestMemberOfStructInsideMethodFromSourceWithDocComment()
        {
            var markup =
@"struct MyStruct {
///<summary>My Field</summary>
public static int SomeField; }
static class Test { static void Method() { int a = MyStruct.Some$$Field; } }";

            Test(markup,
985
                MainDescription($"({FeaturesResources.Field}) int MyStruct.SomeField"),
986 987 988
                Documentation("My Field"));
        }

989
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
990 991 992
        public void TestMetadataFieldMinimal()
        {
            TestInMethod(@"DateTime dt = DateTime.MaxValue$$",
993
                MainDescription($"({FeaturesResources.Field}) DateTime DateTime.MaxValue"));
994 995
        }

996
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
        public void TestMetadataFieldQualified1()
        {
            // NOTE: we qualify the field type, but not the type that contains the field in Dev10
            var markup =
@"class C {
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}";
            Test(markup,
1008
                MainDescription($"({FeaturesResources.Field}) System.DateTime System.DateTime.MaxValue"));
1009 1010
        }

1011
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1012 1013 1014 1015 1016 1017 1018 1019 1020
        public void TestMetadataFieldQualified2()
        {
            Test(@"
class C {
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}",
1021
                MainDescription($"({FeaturesResources.Field}) System.DateTime System.DateTime.MaxValue"));
1022 1023
        }

1024
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
        public void TestMetadataFieldQualified3()
        {
            Test(@"
using System;
class C {
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}",
1035
                MainDescription($"({FeaturesResources.Field}) DateTime DateTime.MaxValue"));
1036 1037
        }

1038
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1039 1040 1041 1042 1043 1044 1045 1046 1047
        public void ConstructedGenericField()
        {
            Test(@"class C<T> { public T Field; }

class D {
    void M() {
        new C<int>().Fi$$eld.ToString();
    }
}",
1048
                MainDescription($"({FeaturesResources.Field}) int C<int>.Field"));
1049 1050
        }

1051
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
        public void UnconstructedGenericField()
        {
            Test(@"
class C<T> {
    public T Field;

    void M() {
        Fi$$eld.ToString();
    }
}",
1062
                MainDescription($"({FeaturesResources.Field}) T C<T>.Field"));
1063 1064
        }

1065
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1066 1067 1068 1069 1070 1071
        public void TestIntegerLiteral()
        {
            TestInMethod(@"int f = 37$$",
                MainDescription("struct System.Int32"));
        }

1072
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1073 1074 1075 1076 1077 1078
        public void TestTrueKeyword()
        {
            TestInMethod(@"bool f = true$$",
                MainDescription("struct System.Boolean"));
        }

1079
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1080 1081 1082 1083 1084 1085 1086
        public void TestFalseKeyword()
        {
            TestInMethod(@"bool f = false$$",
                MainDescription("struct System.Boolean"));
        }

        [WorkItem(756226)]
1087
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
        public void TestAwaitKeywordOnGenericTaskReturningAsync()
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public async Task<int> Calc()
    {
        aw$$ait Calc();
        return 5;
    }
}";
1099
            Test(markup, MainDescription($"{FeaturesResources.PrefixTextForAwaitKeyword} struct System.Int32"));
1100 1101 1102
        }

        [WorkItem(756226)]
1103
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114
        public void TestAwaitKeywordInDeclarationStatement()
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public async Task<int> Calc()
    {
        var x = $$await Calc();
        return 5;
    }
}";
1115
            Test(markup, MainDescription($"{FeaturesResources.PrefixTextForAwaitKeyword} struct System.Int32"));
1116 1117 1118
        }

        [WorkItem(756226)]
1119
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
        public void TestAwaitKeywordOnTaskReturningAsync()
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public async void Calc()
    {
        aw$$ait Task.Delay(100);
    }
}";
1130
            Test(markup, MainDescription($"{FeaturesResources.PrefixTextForAwaitKeyword} {FeaturesResources.TextForSystemVoid}"));
1131 1132 1133
        }

        [WorkItem(756226), WorkItem(756337)]
1134
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164
        public void TestNestedAwaitKeywords1()
        {
            var markup = @"using System;
using System.Threading.Tasks;
class AsyncExample2
{
    async Task<Task<int>> AsyncMethod()
    {
        return NewMethod();
    }

    private static Task<int> NewMethod()
    {
        int hours = 24;
        return hours;
    }

    async Task UseAsync()
    {
        Func<Task<int>> lambda = async () =>
        {
            return await await AsyncMethod();
        };

        int result = await await AsyncMethod();
        Task<Task<int>> resultTask = AsyncMethod();
        result = await awa$$it resultTask;
        result = await lambda();
    }
}";
1165 1166
            Test(markup, MainDescription($"({CSharpFeaturesResources.Awaitable}) {FeaturesResources.PrefixTextForAwaitKeyword} class System.Threading.Tasks.Task<TResult>"),
                         TypeParameterMap($"\r\nTResult {FeaturesResources.Is} int"));
1167 1168 1169
        }

        [WorkItem(756226)]
1170
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200
        public void TestNestedAwaitKeywords2()
        {
            var markup = @"using System;
using System.Threading.Tasks;
class AsyncExample2
{
    async Task<Task<int>> AsyncMethod()
    {
        return NewMethod();
    }

    private static Task<int> NewMethod()
    {
        int hours = 24;
        return hours;
    }

    async Task UseAsync()
    {
        Func<Task<int>> lambda = async () =>
        {
            return await await AsyncMethod();
        };

        int result = await await AsyncMethod();
        Task<Task<int>> resultTask = AsyncMethod();
        result = awa$$it await resultTask;
        result = await lambda();
    }
}";
1201
            Test(markup, MainDescription($"{FeaturesResources.PrefixTextForAwaitKeyword} struct System.Int32"));
1202 1203 1204
        }

        [WorkItem(756226), WorkItem(756337)]
1205
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227
        public void TestAwaitablePrefixOnCustomAwaiter()
        {
            var markup = @"using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Z = $$C;

class C
{
    public MyAwaiter GetAwaiter() { throw new NotImplementedException(); }
}

class MyAwaiter : INotifyCompletion
{
    public void OnCompleted(Action continuation)
    {
        throw new NotImplementedException();
    }

    public bool IsCompleted { get { throw new NotImplementedException(); } }
    public void GetResult() { }
}";
1228
            Test(markup, MainDescription($"({CSharpFeaturesResources.Awaitable}) class C"));
1229 1230 1231
        }

        [WorkItem(756226), WorkItem(756337)]
1232
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242
        public void TestTaskType()
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public void Calc()
    {
        Task$$ v1;
    }
}";
1243
            Test(markup, MainDescription($"({CSharpFeaturesResources.Awaitable}) class System.Threading.Tasks.Task"));
1244 1245 1246
        }

        [WorkItem(756226), WorkItem(756337)]
1247
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258
        public void TestTaskOfTType()
        {
            var markup = @"using System;
using System.Threading.Tasks;
class C
{
    public void Calc()
    {
        Task$$<int> v1;
    }
}";
1259 1260
            Test(markup, MainDescription($"({CSharpFeaturesResources.Awaitable}) class System.Threading.Tasks.Task<TResult>"),
                         TypeParameterMap($"\r\nTResult {FeaturesResources.Is} int"));
1261 1262
        }

1263
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1264 1265 1266 1267 1268 1269
        public void TestStringLiteral()
        {
            TestInMethod(@"string f = ""Foo""$$",
                MainDescription("class System.String"));
        }

1270
        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1271
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1272 1273 1274 1275 1276 1277 1278
        public void TestVerbatimStringLiteral()
        {
            TestInMethod(@"string f = @""cat""$$",
                MainDescription("class System.String"));
        }

        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1279
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1280 1281 1282 1283 1284 1285 1286 1287 1288
        public void TestInterpolatedStringLiteral()
        {
            TestInMethod(@"string f = $""cat""$$", MainDescription("class System.String"));
            TestInMethod(@"string f = $""c$$at""", MainDescription("class System.String"));
            TestInMethod(@"string f = $""$$cat""", MainDescription("class System.String"));
            TestInMethod(@"string f = $""cat {1$$ + 2} dog""", MainDescription("struct System.Int32"));
        }

        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1289
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1290 1291 1292 1293 1294 1295 1296 1297
        public void TestVerbatimInterpolatedStringLiteral()
        {
            TestInMethod(@"string f = $@""cat""$$", MainDescription("class System.String"));
            TestInMethod(@"string f = $@""c$$at""", MainDescription("class System.String"));
            TestInMethod(@"string f = $@""$$cat""", MainDescription("class System.String"));
            TestInMethod(@"string f = $@""cat {1$$ + 2} dog""", MainDescription("struct System.Int32"));
        }

1298
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1299 1300 1301 1302 1303 1304
        public void TestCharLiteral()
        {
            TestInMethod(@"string f = 'x'$$",
                MainDescription("struct System.Char"));
        }

1305
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1306 1307 1308 1309
        public void DynamicKeyword()
        {
            TestInMethod(@"dyn$$amic dyn;",
                MainDescription("dynamic"),
1310
                Documentation(FeaturesResources.RepresentsAnObjectWhoseOperations));
1311 1312
        }

1313
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1314 1315 1316 1317 1318 1319 1320
        public void DynamicField()
        {
            TestInClass(@"dynamic dyn;
void M()
{
    d$$yn.Foo();
}",
1321
                MainDescription($"({FeaturesResources.Field}) dynamic C.dyn"));
1322 1323
        }

1324
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334
        public void LocalProperty_Minimal()
        {
            TestInClass(@"DateTime Prop { get; set; }
void M()
{
    P$$rop.ToString();
}",
                MainDescription("DateTime C.Prop { get; set; }"));
        }

1335
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1336 1337 1338 1339 1340 1341 1342 1343 1344 1345
        public void LocalProperty_Minimal_PrivateSet()
        {
            TestInClass(@"public DateTime Prop { get; private set; }
void M()
{
    P$$rop.ToString();
}",
                MainDescription("DateTime C.Prop { get; private set; }"));
        }

1346
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356
        public void LocalProperty_Minimal_PrivateSet1()
        {
            TestInClass(@"protected internal int Prop { get; private set; }
void M()
{
    P$$rop.ToString();
}",
                MainDescription("int C.Prop { get; private set; }"));
        }

1357
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
        public void LocalProperty_Qualified()
        {
            TestInClass(@"System.IO.FileInfo Prop { get; set; }
void M()
{
    P$$rop.ToString();
}",
                MainDescription("System.IO.FileInfo C.Prop { get; set; }"));
        }

1368
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1369 1370 1371 1372 1373 1374
        public void NonLocalProperty_Minimal()
        {
            TestInMethod(@"DateTime.No$$w.ToString();",
                MainDescription("DateTime DateTime.Now { get; }"));
        }

1375
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1376 1377 1378 1379 1380 1381
        public void NonLocalProperty_Qualified()
        {
            TestInMethod(@"System.IO.FileInfo f; f.Att$$ributes.ToString();",
                MainDescription("System.IO.FileAttributes System.IO.FileSystemInfo.Attributes { get; set; }"));
        }

1382
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
        public void ConstructedGenericProperty()
        {
            Test(@"
class C<T> {
    public T Property{ get; set }
}

class D {
    void M() {
        new C<int>().Pro$$perty.ToString();
    }
}",
                MainDescription("int C<int>.Property { get; set; }"));
        }

1398
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411
        public void UnconstructedGenericProperty()
        {
            Test(@"
class C<T> {
    public T Property { get; set}

    void M() {
        Pro$$perty.ToString();
    }
}",
                MainDescription("T C<T>.Property { get; set; }"));
        }

1412
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1413 1414 1415
        public void ValueInProperty()
        {
            TestInClass(@"public DateTime Property {set { foo = val$$ue; } }",
1416
                MainDescription($"({FeaturesResources.Parameter}) DateTime value"));
1417 1418
        }

1419
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1420 1421 1422 1423 1424 1425
        public void EnumTypeName()
        {
            TestInMethod(@"Consol$$eColor c",
                MainDescription("enum System.ConsoleColor"));
        }

1426
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1427 1428 1429 1430 1431 1432
        public void EnumMemberNameFromMetadata()
        {
            TestInMethod(@"ConsoleColor c = ConsoleColor.Bla$$ck",
                MainDescription("ConsoleColor.Black = 0"));
        }

1433
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1434 1435 1436 1437 1438 1439
        public void FlagsEnumMemberNameFromMetadata1()
        {
            TestInMethod(@"AttributeTargets a = AttributeTargets.Cl$$ass",
                MainDescription("AttributeTargets.Class = 4"));
        }

1440
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1441 1442 1443 1444 1445 1446
        public void FlagsEnumMemberNameFromMetadata2()
        {
            TestInMethod(@"AttributeTargets a = AttributeTargets.A$$ll",
                MainDescription("AttributeTargets.All = AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter"));
        }

1447
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467
        public void EnumMemberNameFromSource1()
        {
            Test(@"
enum E
{
    A = 1 << 0,
    B = 1 << 1,
    C = 1 << 2
}

class C
{
    void M()
    {
        var e = E.B$$;
    }
}",
    MainDescription("E.B = 1 << 1"));
        }

1468
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488
        public void EnumMemberNameFromSource2()
        {
            Test(@"
enum E
{
    A,
    B,
    C
}

class C
{
    void M()
    {
        var e = E.B$$;
    }
}",
    MainDescription("E.B = 1"));
        }

1489
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1490 1491 1492
        public void Parameter_InMethod_Minimal()
        {
            TestInClass(@"void M(DateTime dt) { d$$t.ToString();",
1493
                MainDescription($"({FeaturesResources.Parameter}) DateTime dt"));
1494 1495
        }

1496
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1497 1498 1499
        public void Parameter_InMethod_Qualified()
        {
            TestInClass(@"void M(System.IO.FileInfo fileInfo) { file$$Info.ToString();",
1500
                MainDescription($"({FeaturesResources.Parameter}) System.IO.FileInfo fileInfo"));
1501 1502
        }

1503
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1504 1505 1506
        public void Parameter_FromReferenceToNamedParameter()
        {
            TestInMethod(@"Console.WriteLine(va$$lue: ""Hi"");",
1507
                MainDescription($"({FeaturesResources.Parameter}) string value"));
1508 1509
        }

1510
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1511 1512 1513 1514 1515
        public void Parameter_DefaultValue()
        {
            // NOTE: Dev10 doesn't show the default value, but it would be nice if we did.
            // NOTE: The "DefaultValue" property isn't implemented yet.
            TestInClass(@"void M(int param = 42) { para$$m.ToString(); }",
1516
                MainDescription($"({FeaturesResources.Parameter}) int param = 42"));
1517 1518
        }

1519
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1520 1521 1522
        public void Parameter_Params()
        {
            TestInClass(@"void M(params DateTime[] arg) { ar$$g.ToString(); }",
1523
                MainDescription($"({FeaturesResources.Parameter}) params DateTime[] arg"));
1524 1525
        }

1526
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1527 1528 1529
        public void Parameter_Ref()
        {
            TestInClass(@"void M(ref DateTime arg) { ar$$g.ToString(); }",
1530
                MainDescription($"({FeaturesResources.Parameter}) ref DateTime arg"));
1531 1532
        }

1533
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1534 1535 1536
        public void Parameter_Out()
        {
            TestInClass(@"void M(out DateTime arg) { ar$$g.ToString(); }",
1537
                MainDescription($"({FeaturesResources.Parameter}) out DateTime arg"));
1538 1539
        }

1540
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1541 1542 1543
        public void Local_Minimal()
        {
            TestInMethod(@"DateTime dt; d$$t.ToString();",
1544
                MainDescription($"({FeaturesResources.LocalVariable}) DateTime dt"));
1545 1546
        }

1547
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1548 1549 1550
        public void Local_Qualified()
        {
            TestInMethod(@"System.IO.FileInfo fileInfo; file$$Info.ToString();",
1551
                MainDescription($"({FeaturesResources.LocalVariable}) System.IO.FileInfo fileInfo"));
1552 1553
        }

1554
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1555 1556 1557
        public void Method_MetadataOverload()
        {
            TestInMethod("Console.Write$$Line();",
1558
                MainDescription($"void Console.WriteLine() (+ 18 {FeaturesResources.Overloads})"));
1559 1560
        }

1561
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1562 1563 1564 1565 1566
        public void Method_SimpleWithOverload()
        {
            TestInClass(@"
void Method() { Met$$hod(); }
void Method(int i) { }",
1567
                MainDescription($"void C.Method() (+ 1 {FeaturesResources.Overload})"));
1568 1569
        }

1570
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1571 1572 1573 1574 1575 1576 1577
        public void Method_MoreOverloads()
        {
            TestInClass(@"
void Method() { Met$$hod(null); }
void Method(int i) { }
void Method(DateTime dt) { }
void Method(System.IO.FileInfo fileInfo) { }",
1578
                MainDescription($"void C.Method(System.IO.FileInfo fileInfo) (+ 3 {FeaturesResources.Overloads})"));
1579 1580
        }

1581
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1582 1583 1584 1585 1586 1587
        public void Method_SimpleInSameClass()
        {
            TestInClass(@"DateTime GetDate(System.IO.FileInfo ft) { Get$$Date(null); }",
                MainDescription("DateTime C.GetDate(System.IO.FileInfo ft)"));
        }

1588
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1589 1590 1591 1592 1593 1594 1595 1596
        public void Method_OptionalParameter()
        {
            TestInClass(@"
void M() { Met$$hod(); }
void Method(int i = 0) { }",
                MainDescription("void C.Method([int i = 0])"));
        }

1597
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1598 1599 1600 1601
        public void Method_OptionalDecimalParameter()
        {
            TestInClass(@"
void Foo(decimal x$$yz = 10) { }",
1602
                MainDescription($"({FeaturesResources.Parameter}) decimal xyz = 10"));
1603 1604
        }

1605
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616
        public void Method_Generic()
        {
            // Generic method don't get the instantiation info yet.  NOTE: We don't display
            // constraint info in Dev10. Should we?
            TestInClass(@"TOut Foo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn> {
    Fo$$o<int, DateTime>(37);
}",

            MainDescription("DateTime C.Foo<int, DateTime>(int arg)"));
        }

1617
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1618 1619 1620 1621 1622 1623 1624 1625 1626
        public void Method_UnconstructedGeneric()
        {
            TestInClass(@"TOut Foo<TIn, TOut>(TIn arg) {
    Fo$$o<TIn, TOut>(default(TIn);
}",

                MainDescription("TOut C.Foo<TIn, TOut>(TIn arg)"));
        }

1627
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1628 1629 1630 1631 1632 1633 1634 1635
        public void Method_Inferred()
        {
            TestInClass(@"void Foo<TIn>(TIn arg) {
    Fo$$o(42);
}",
                MainDescription("void C.Foo<int>(int arg)"));
        }

1636
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1637 1638 1639 1640 1641 1642 1643 1644
        public void Method_MultipleParams()
        {
            TestInClass(@"void Foo(DateTime dt, System.IO.FileInfo fi, int number) {
    Fo$$o(DateTime.Now, null, 32);
}",
                MainDescription("void C.Foo(DateTime dt, System.IO.FileInfo fi, int number)"));
        }

1645
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1646 1647 1648 1649 1650 1651 1652 1653 1654
        public void Method_OptionalParam()
        {
            // NOTE - Default values aren't actually returned by symbols yet.
            TestInClass(@"void Foo(int num = 42) {
    Fo$$o();
}",
                MainDescription("void C.Foo([int num = 42])"));
        }

1655
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1656 1657 1658 1659 1660 1661 1662 1663 1664
        public void Method_ParameterModifiers()
        {
            // NOTE - Default values aren't actually returned by symbols yet.
            TestInClass(@"void Foo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers) {
    Fo$$o(DateTime.Now, null, 32);
}",
                MainDescription("void C.Foo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers)"));
        }

1665
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1666 1667 1668 1669 1670 1671
        public void Constructor()
        {
            TestInClass(@"public C() {} void M() { new C$$ ().ToString(); }",
                MainDescription("C.C()"));
        }

1672
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683
        public void Constructor_Overloads()
        {
            TestInClass(@"
public C() {}
public C(DateTime dt) {}
public C(int i) {}

void M()
{
    new C$$ (DateTime.MaxValue).ToString();
}",
1684
                MainDescription($"C.C(DateTime dt) (+ 2 {FeaturesResources.Overloads})"));
1685 1686 1687 1688 1689
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
1690
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1691 1692 1693
        public void Constructor_OverloadFromStringLiteral()
        {
            TestInMethod(@"new InvalidOperatio$$nException("""");",
1694
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.Overloads})"));
1695 1696 1697 1698 1699
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
1700
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1701 1702 1703 1704 1705 1706 1707 1708
        public void Constructor_UnknownType()
        {
            TestInvalidTypeInClass(@"void M() { new F$$oo(); }");
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
1709
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1710 1711 1712
        public void Constructor_OverloadFromProperty()
        {
            TestInMethod(@"new InvalidOperatio$$nException(this.GetType().Name);",
1713
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.Overloads})"));
1714 1715
        }

1716
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1717 1718 1719
        public void Constructor_Metadata()
        {
            TestInMethod(@"new Argument$$NullException();",
1720
                MainDescription($"ArgumentNullException.ArgumentNullException() (+ 3 {FeaturesResources.Overloads})"));
1721 1722
        }

1723
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1724 1725 1726 1727 1728 1729
        public void Constructor_MetadataQualified()
        {
            TestInMethod(@"new System.IO.File$$Info(null);",
                MainDescription("System.IO.FileInfo.FileInfo(string fileName)"));
        }

1730
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1731 1732 1733 1734 1735 1736 1737 1738 1739 1740
        public void InterfaceProperty()
        {
            TestInMethod(@"
interface I
{
    string Name$$ { get; set; }
}",
                MainDescription("string I.Name { get; set; }"));
        }

1741
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760
        public void ExplicitInterfacePropertyImplementation()
        {
            TestInMethod(@"
interface I
{
    string Name { get; set; }
}

class C : I
{
    string IEmployee.Name$$
    {
       get { return """"; }
       set { }
    }
}",
                MainDescription("string C.Name { get; set; }"));
        }

1761
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1762 1763 1764 1765 1766 1767 1768 1769 1770 1771
        public void Operator()
        {
            TestInClass(@"
public static C operator +(C left, C right) { return null; }
void M(C left, C right) { return left +$$ right; }
",
                MainDescription("C C.operator +(C left, C right)"));
        }

        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
1772
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1773 1774 1775 1776 1777 1778 1779 1780 1781
        public void GenericMethodWithConstraintsAtDeclaration()
        {
            TestInClass(@"TOut F$$oo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn> {
}",

            MainDescription("TOut C.Foo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>"));
        }

        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
1782
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794
        public void GenericMethodWithMultipleConstraintsAtDeclaration()
        {
            TestInClass(@"TOut Foo<TIn, TOut>(TIn arg) where TIn : Employee, new()
{
    Fo$$o<TIn, TOut>(default(TIn);
}
",

            MainDescription("TOut C.Foo<TIn, TOut>(TIn arg) where TIn : Employee, new()"));
        }

        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
1795
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806
        public void UnConstructedGenericMethodWithConstraintsAtInvocation()
        {
            TestInClass(@"TOut Foo<TIn, TOut>(TIn arg) where TIn : Employee
{
    Fo$$o<TIn, TOut>(default(TIn);
}
",

            MainDescription("TOut C.Foo<TIn, TOut>(TIn arg) where TIn : Employee"));
        }

1807
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823
        public void GenericTypeWithConstraintsAtDeclaration()
        {
            Test(@"public class Employee : IComparable<Employee>
{
    public int CompareTo(Employee other)
    {
        throw new NotImplementedException();
    }
}
class Emplo$$yeeList<T> : IEnumerable<T> where T : Employee, System.IComparable<T>, new()
{
}",

            MainDescription("class EmployeeList<T> where T : Employee, System.IComparable<T>, new()"));
        }

1824
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1825 1826 1827 1828 1829 1830 1831 1832
        public void GenericType()
        {
            Test(@"
class T1<T11>
{
    $$T11 i;
}
",
1833
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
1834 1835
        }

1836
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1837 1838 1839 1840 1841 1842 1843 1844
        public void GenericMethod()
        {
            TestInClass(@"
    static void Meth1<T1>(T1 i) where T1 : struct
    {
        $$T1 i;
    }
",
1845
                MainDescription($"T1 {FeaturesResources.In} C.Meth1<T1> where T1 : struct"));
1846 1847
        }

1848
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1849 1850 1851 1852 1853 1854
        public void Var()
        {
            TestInMethod(@"
var x = new Exception();
var y = $$x;
",
1855
                MainDescription($"({FeaturesResources.LocalVariable}) Exception x"));
1856 1857
        }

1858
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1859 1860 1861 1862 1863 1864
        public void NestedInGeneric()
        {
            TestInMethod(@"
            List<int>.Enu$$merator e;
",
                MainDescription("struct System.Collections.Generic.List<T>.Enumerator"),
1865
                TypeParameterMap($"\r\nT {FeaturesResources.Is} int"));
1866 1867
        }

1868
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885
        public void NestedGenericInGeneric()
        {
            Test(@"
            class Outer<T>
{
    class Inner<U>
    {
    }

    static void M()
    {
        Outer<int>.I$$nner<string> e;
    }
}
",
                MainDescription("class Outer<T>.Inner<U>"),
                TypeParameterMap(
1886 1887
                    Lines($"\r\nT {FeaturesResources.Is} int",
                          $"U {FeaturesResources.Is} string")));
1888 1889
        }

1890
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903
        public void ObjectInitializer1()
        {
            TestInClass(@"
    void M()
    {
        var x = new test() { $$z = 5 };
    }

    class test
    {
        public int z;
    }
",
1904
                MainDescription($"({FeaturesResources.Field}) int test.z"));
1905 1906
        }

1907
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926
        public void ObjectInitializer2()
        {
            TestWithUsings(@"
class C
{
    void M()
    {
        var x = new test() { z = $$5 };
    }

    class test
    {
        public int z;
    }
}
",
                MainDescription("struct System.Int32"));
        }

1927
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939
        [WorkItem(537880)]
        public void TypeArgument()
        {
            Test(@"
class C<T, Y>
{
    void M()
    {
        C<int, DateTime> variable;
        $$variable = new C<int, DateTime>();
    }
}",
1940
                MainDescription($"({FeaturesResources.LocalVariable}) C<int, DateTime> variable"));
1941 1942
        }

1943
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1944 1945 1946 1947 1948 1949 1950 1951 1952 1953
        public void ForEachLoop_1()
        {
            TestInMethod(@"
int bb = 555;
bb = bb + 1;
foreach (int cc in new int[]{ 1,2,3}){
c$$c = 1;
bb = bb + 21;
}
",
1954
                MainDescription($"({FeaturesResources.LocalVariable}) int cc"));
1955 1956
        }

1957
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971
        public void TryCatchFinally_1()
        {
            TestInMethod(@"
            try
            {
                int aa = 555;
                a$$a = aa + 1;
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }",
1972
                MainDescription($"({FeaturesResources.LocalVariable}) int aa"));
1973 1974
        }

1975
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
        public void TryCatchFinally_2()
        {
            TestInMethod(@"
            try
            {
            }
            catch (Exception ex)
            {
                var y = e$$x;
                var z = y;
            }
            finally
            {
            }
",
1991
                MainDescription($"({FeaturesResources.LocalVariable}) Exception ex"));
1992 1993
        }

1994
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
        public void TryCatchFinally_3()
        {
            TestInMethod(@"
            try
            {
            }
            catch (Exception ex)
            {
                var aa = 555;
                aa = a$$a + 1;
            }
            finally
            {
            }
",
2010
                MainDescription($"({FeaturesResources.LocalVariable}) int aa"));
2011 2012
        }

2013
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028
        public void TryCatchFinally_4()
        {
            TestInMethod(@"
            try
            {
            }
            catch (Exception ex)
            {
            }
            finally
            {
                int aa = 555;
                aa = a$$a + 1;
            }
",
2029
                MainDescription($"({FeaturesResources.LocalVariable}) int aa"));
2030 2031
        }

2032
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044
        public void GenericVariable()
        {
            Test(@"
            class C<T, Y>
            {
                void M()
                {
                    C<int, DateTime> variable;
                    var$$iable = new C<int, DateTime>();
                }
            }
",
2045
                MainDescription($"({FeaturesResources.LocalVariable}) C<int, DateTime> variable"));
2046 2047
        }

2048
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059
        public void TestInstantiation()
        {
            Test(@"
using System.Collections.Generic;
class Program<T>
{
    static void Main(string[] args)
    {
        var p = new Dictio$$nary<int, string>();
    }
}",
2060
                MainDescription($"Dictionary<int, string>.Dictionary() (+ 5 {FeaturesResources.Overloads})"));
2061 2062
        }

2063
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074
        public void TestUsingAlias_Bug4141()
        {
            Test(@"using X = A.C;
class A {
public class C { }
}
class D : X$$ { }
",
                MainDescription(@"class A.C"));
        }

2075
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2076 2077 2078 2079
        public void TestFieldOnDeclaration()
        {
            TestInClass(@"
DateTime fie$$ld;",
2080
                MainDescription($"({FeaturesResources.Field}) DateTime C.field"));
2081 2082 2083
        }

        [WorkItem(538767)]
2084
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2085 2086 2087 2088
        public void TestGenericErrorFieldOnDeclaration()
        {
            TestInClass(@"
NonExistentType<int> fi$$eld;",
2089
                MainDescription($"({FeaturesResources.Field}) NonExistentType<int> C.field"));
2090 2091 2092
        }

        [WorkItem(538822)]
2093
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2094 2095 2096 2097 2098 2099
        public void TestDelegateType()
        {
            TestInClass(@"
Fun$$c<int, string> field;",
                MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"),
                TypeParameterMap(
2100 2101
                    Lines($"\r\nT {FeaturesResources.Is} int",
                          $"TResult {FeaturesResources.Is} string")));
2102 2103 2104
        }

        [WorkItem(538824)]
2105
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118
        public void TestOnDelegateInvocation()
        {
            Test(@"
class Program
{
    delegate void D1();
    static void Main()
    {
        D1 d = Main;
        $$d(); 
    }
}
",
2119
                MainDescription($"({FeaturesResources.LocalVariable}) D1 d"));
2120 2121 2122
        }

        [WorkItem(539240)]
2123
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136
        public void TestOnArrayCreation1()
        {
            Test(@"
class Program
{
    static void Main()
    {
        int[] a = n$$ew int[0];
    }
}");
        }

        [WorkItem(539240)]
2137
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151
        public void TestOnArrayCreation2()
        {
            Test(@"
class Program
{
    static void Main()
    {
        int[] a = new i$$nt[0];
    }
}",
                MainDescription("struct System.Int32"));
        }

        [WorkItem(539841)]
2152
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2153 2154 2155 2156 2157 2158 2159 2160
        public void TestIsNamedTypeAccessibleForErrorTypes()
        {
            Test(@"sealed class B<T1, T2> : A<B<T1, T2>>{
    protected sealed override B<A<T>, A$$<T>> N() { }} internal class A<T>{}",
                MainDescription("class A<T>"));
        }

        [WorkItem(540075)]
2161
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175
        public void TestErrorType()
        {
            Test(@"using Foo = Foo;
class C
{
    void Main()
    {
        $$Foo
    }
}",
                MainDescription("Foo"));
        }

        [WorkItem(540871)]
2176
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199
        public void TestLiterals()
        {
            Test(@"class MyClass
{
    MyClass()
        : this($$10)
    {
        intI = 2;
    }
 
    public MyClass(int i) { }
 
    static int intI = 1;
 
    public static int Main()
    {
        return 1;
    }
}",
                MainDescription("struct System.Int32"));
        }

        [WorkItem(541444)]
2200
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213
        public void TestErrorInForeach()
        {
            Test(@"
class C
{
    void Main()
    {
        foreach (int cc in null)
        {
            $$cc = 1;
        }
    }
}",
2214
                MainDescription($"({FeaturesResources.LocalVariable}) int cc"));
2215 2216 2217
        }

        [WorkItem(540438)]
2218
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233
        public void TestNoQuickInfoOnAnonymousDelegate()
        {
            Test(@"
using System;

class Program
{
    static void Main(string[] args)
    {
        Action a = $$delegate { };
    }
}");
        }

        [WorkItem(541678)]
2234
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260
        public void TestQuickInfoOnEvent()
        {
            Test(@"
using System;
 
public class SampleEventArgs
{
    public SampleEventArgs(string s) { Text = s; }
    public String Text { get; private set; } 
}
public class Publisher
{
    public delegate void SampleEventHandler(object sender, SampleEventArgs e);
    public event SampleEventHandler SampleEvent;
 
    protected virtual void RaiseSampleEvent()
    {
        if (Sam$$pleEvent != null)
            SampleEvent(this, new SampleEventArgs(""Hello""));
    }
}
",
                MainDescription("SampleEventHandler Publisher.SampleEvent"));
        }

        [WorkItem(542157)]
2261
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2262 2263 2264 2265 2266 2267 2268
        public void TestEvent()
        {
            TestInMethod(@"System.Console.CancelKeyPres$$s += null;",
                MainDescription("ConsoleCancelEventHandler Console.CancelKeyPress"));
        }

        [WorkItem(542157)]
2269
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2270 2271 2272 2273 2274 2275 2276
        public void TestEventPlusEqualsOperator()
        {
            TestInMethod(@"System.Console.CancelKeyPress +$$= null;",
                MainDescription("void Console.CancelKeyPress.add"));
        }

        [WorkItem(542157)]
2277
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2278 2279 2280 2281 2282 2283 2284
        public void TestEventMinusEqualsOperator()
        {
            TestInMethod(@"System.Console.CancelKeyPress -$$= null;",
                MainDescription("void Console.CancelKeyPress.remove"));
        }

        [WorkItem(541885)]
2285
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309
        public void TestQuickInfoOnExtensionMethod()
        {
            TestWithOptions(Options.Regular, @"
using System;
using System.Collections.Generic;
using System.Linq;
 
class Program
{
    static void Main(string[] args)
    {
        int[] values = { 1 };
        bool isArray = 7.I$$n(values);
    }
}
 
public static class MyExtensions
{
    public static bool In<T>(this T o, IEnumerable<T> items)
    {
        return true;
    }
}
",
2310
                MainDescription($"({CSharpFeaturesResources.Extension}) bool int.In<int>(IEnumerable<int> items)"));
2311 2312
        }

2313
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334
        public void TestQuickInfoOnExtensionMethodOverloads()
        {
            TestWithOptions(Options.Regular, @"
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
       ""1"".Test$$Ext();
    }
}
 
public static class Ex
{
    public static void TestExt<T>(this T ex) { }
    public static void TestExt<T>(this T ex, T arg) { }
    public static void TestExt(this string ex, int arg) { }
}
",
2335
                MainDescription($"({CSharpFeaturesResources.Extension}) void string.TestExt<string>() (+ 2 {FeaturesResources.Overloads})"));
2336 2337
        }

2338
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359
        public void TestQuickInfoOnExtensionMethodOverloads2()
        {
            TestWithOptions(Options.Regular, @"
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
       ""1"".Test$$Ext();
    }
}
 
public static class Ex
{
    public static void TestExt<T>(this T ex) { }
    public static void TestExt<T>(this T ex, T arg) { }
    public static void TestExt(this int ex, int arg) { }
}
",
2360
                MainDescription($"({CSharpFeaturesResources.Extension}) void string.TestExt<string>() (+ 1 {FeaturesResources.Overload})"));
2361 2362
        }

2363
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376
        public void Query1()
        {
            Test(@"
using System.Linq;
class C
{
    void M()
    {
        var q = from n in new int[] { 1, 2, 3, 4, 5}
                select $$n;
    }
}
",
2377
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2378 2379
        }

2380
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393
        public void Query2()
        {
            Test(@"
using System.Linq;
class C
{
    void M()
    {
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5}
                select n;
    }
}
",
2394
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2395 2396
        }

2397
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409
        public void Query3()
        {
            Test(@"
class C
{
    void M()
    {
        var q = from n in new int[] { 1, 2, 3, 4, 5}
                select $$n;
    }
}
",
2410
                MainDescription($"({FeaturesResources.RangeVariable}) ? n"));
2411 2412
        }

2413
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425
        public void Query4()
        {
            Test(@"
class C
{
    void M()
    {
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5}
                select n;
    }
}
",
2426
                MainDescription($"({FeaturesResources.RangeVariable}) ? n"));
2427 2428
        }

2429
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443
        public void Query5()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from n in new List<object>()
                select $$n;
    }
}
",
2444
                MainDescription($"({FeaturesResources.RangeVariable}) object n"));
2445 2446
        }

2447
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461
        public void Query6()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from n$$ in new List<object>()
                select n;
    }
}
",
2462
                MainDescription($"({FeaturesResources.RangeVariable}) object n"));
2463 2464
        }

2465
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479
        public void Query7()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from int n in new List<object>()
                select $$n;
    }
}
",
2480
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2481 2482
        }

2483
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497
        public void Query8()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from int n$$ in new List<object>()
                select n;
    }
}
",
2498
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2499 2500
        }

2501
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516
        public void Query9()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from x$$ in new List<List<int>>()
                from y in x
                select y;
    }
}
",
2517
                MainDescription($"({FeaturesResources.RangeVariable}) List<int> x"));
2518 2519
        }

2520
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535
        public void Query10()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y in $$x
                select y;
    }
}
",
2536
                MainDescription($"({FeaturesResources.RangeVariable}) List<int> x"));
2537 2538
        }

2539
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554
        public void Query11()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y$$ in x
                select y;
    }
}
",
2555
                MainDescription($"({FeaturesResources.RangeVariable}) int y"));
2556 2557
        }

2558
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573
        public void Query12()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y in x
                select $$y;
    }
}
",
2574
                MainDescription($"({FeaturesResources.RangeVariable}) int y"));
2575 2576 2577
        }

        [WorkItem(543205)]
2578
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593
        public void TestErrorGlobal()
        {
            Test(@"extern alias global;
 
class myClass
{
    static int Main()
    {
        $$global::otherClass oc = new global::otherClass();
        return 0;
    }
}",
                MainDescription("<global namespace>"));
        }

2594
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2595 2596 2597 2598 2599 2600 2601 2602
        public void DontRemoveAttributeSuffixAndProduceInvalidIdentifier1()
        {
            Test(@"
using System;
class classAttribute : Attribute
{
    private classAttribute x$$;
}",
2603
                MainDescription($"({FeaturesResources.Field}) classAttribute classAttribute.x"));
2604 2605 2606
        }

        [WorkItem(544026)]
2607
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2608 2609 2610 2611 2612 2613 2614 2615
        public void DontRemoveAttributeSuffix2()
        {
            Test(@"
using System;
class class1Attribute : Attribute
{
    private class1Attribute x$$;
}",
2616
                MainDescription($"({FeaturesResources.Field}) class1Attribute class1Attribute.x"));
2617 2618
        }

2619
        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
2620
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643
        public void AttributeQuickInfoBindsToClassTest()
        {
            Test(@"
using System;

/// <summary>
/// class comment
/// </summary>
[Some$$]
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
    }
}
",
                Documentation("class comment"));
        }

        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
2644
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666
        public void AttributeConstructorQuickInfo()
        {
            Test(@"
using System;

/// <summary>
/// class comment
/// </summary>
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
        var s = new Some$$Attribute();
    }
}
",
                Documentation("ctor comment"));
        }

2667
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2668 2669 2670
        public void TestLabel()
        {
            TestInClass(@"void M() { Foo: int Foo; goto Foo$$; }",
2671
                MainDescription($"({FeaturesResources.Label}) Foo"));
2672 2673 2674
        }

        [WorkItem(542613)]
2675
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692
        public void TestUnboundGeneric()
        {
            Test(@"
using System;
using System.Collections.Generic;
class C
{
    void M()
    {
        Type t = typeof(L$$ist<>);
    }
}",
                MainDescription("class System.Collections.Generic.List<T>"),
                NoTypeParameterMap);
        }

        [WorkItem(543113)]
2693
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706
        public void TestAnonymousTypeNew1()
        {
            Test(@"
class C
{
    void M()
    {
        var v = $$new { };
    }
}",
                MainDescription(@"AnonymousType 'a"),
                NoTypeParameterMap,
                AnonymousTypes(
2707 2708 2709
$@"
{FeaturesResources.AnonymousTypes}
    'a {FeaturesResources.Is} new {{  }}"));
2710 2711 2712
        }

        [WorkItem(543873)]
2713
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2714 2715 2716 2717 2718 2719 2720 2721
        public void TestNestedAnonymousType()
        {
            // verify nested anonymous types are listed in the same order for different properties
            // verify first property
            TestInMethod(@"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } }; x[0].$$Address",
                MainDescription(@"'b 'a.Address { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
2722 2723 2724 2725
$@"
{FeaturesResources.AnonymousTypes}
    'a {FeaturesResources.Is} new {{ string Name, 'b Address }}
    'b {FeaturesResources.Is} new {{ string Street, string Zip }}"));
2726 2727 2728 2729 2730 2731

            // verify second property
            TestInMethod(@"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } }; x[0].$$Name",
                MainDescription(@"string 'a.Name { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
2732 2733 2734 2735
$@"
{FeaturesResources.AnonymousTypes}
    'a {FeaturesResources.Is} new {{ string Name, 'b Address }}
    'b {FeaturesResources.Is} new {{ string Street, string Zip }}"));
2736 2737
        }

2738
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751
        [WorkItem(543183)]
        public void TestAssignmentOperatorInAnonymousType()
        {
            Test(@"class C
{
    void M()
    {
        var a = new { A $$= 0 };
    }
}
");
        }

2752
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2753 2754 2755 2756 2757 2758 2759
        [WorkItem(10731, "DevDiv_Projects/Roslyn")]
        public void TestErrorAnonymousTypeDoesntShow()
        {
            TestInMethod(@"var a = new { new { N = 0 }.N, new { } }.$$N;",
                MainDescription(@"int 'a.N { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
2760 2761 2762
$@"
{FeaturesResources.AnonymousTypes}
    'a {FeaturesResources.Is} new {{ int N }}"));
2763 2764
        }

2765
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780
        [WorkItem(543553)]
        public void TestArrayAssignedToVar()
        {
            Test(@"class C
{
    static void M(string[] args)
    {
        v$$ar a = args;
    }
}
",
                MainDescription("string[]"));
        }

        [WorkItem(529139)]
2781
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802
        public void ColorColorRangeVariable()
        {
            Test(@"
using System.Collections.Generic;
using System.Linq;

namespace N1
{
    class yield
    {
        public static IEnumerable<yield> Bar()
        {
            foreach (yield yield in from yield in new yield[0]
                                    select y$$ield)
            {
                yield return yield;
            }
        }
    }
}
",
2803
                MainDescription($"({FeaturesResources.RangeVariable}) N1.yield yield"));
2804 2805 2806
        }

        [WorkItem(543550)]
2807
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833
        public void QuickInfoOnOperator()
        {
            Test(@"using System.Collections.Generic;
 
class Program
{
    static void Main(string[] args)
    {
        var v = new Program() $$+ string.Empty;
    }
 
    public static implicit operator Program(string s)
    {
        return null;
    }
 
    public static IEnumerable<Program> operator +(Program p1, Program p2)
    {
        yield return p1;
        yield return p2;
    }
}
",
                MainDescription("IEnumerable<Program> Program.operator +(Program p1, Program p2)"));
        }

2834
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2835 2836 2837
        public void TestConstantField()
        {
            Test("class C { const int $$F = 1;",
2838
                MainDescription($"({FeaturesResources.Constant}) int C.F = 1"));
2839 2840
        }

2841
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2842 2843 2844
        public void TestMultipleConstantFields()
        {
            Test("class C { public const double X = 1.0, Y = 2.0, $$Z = 3.5;",
2845
                MainDescription($"({FeaturesResources.Constant}) double C.Z = 3.5"));
2846 2847
        }

2848
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859
        public void TestConstantDependencies()
        {
            Test(@"class A
{
    public const int $$X = B.Z + 1;
    public const int Y = 10;
}
class B
{
    public const int Z = A.Y + 1;
}",
2860
                MainDescription($"({FeaturesResources.Constant}) int A.X = B.Z + 1"));
2861 2862
        }

2863
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2864 2865 2866 2867 2868 2869 2870 2871 2872 2873
        public void TestConstantCircularDependencies()
        {
            Test(@"class A
{
    public const int X = B.Z + 1;
}
class B
{
    public const int Z$$ = A.X + 1;
}",
2874
                MainDescription($"({FeaturesResources.Constant}) int B.Z = A.X + 1"));
2875 2876 2877
        }

        [WorkItem(544620)]
2878
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2879 2880 2881 2882 2883 2884
        public void TestConstantOverflow()
        {
            Test(@"class B
{
    public const int Z$$ = int.MaxValue + 1;
}",
2885
                MainDescription($"({FeaturesResources.Constant}) int B.Z = int.MaxValue + 1"));
2886 2887 2888
        }

        [WorkItem(544620)]
2889
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2890 2891 2892 2893 2894 2895
        public void TestConstantOverflowInUncheckedContext()
        {
            Test(@"class B
{
    public const int Z$$ = unchecked(int.MaxValue + 1);
}",
2896
                MainDescription($"({FeaturesResources.Constant}) int B.Z = unchecked(int.MaxValue + 1)"));
2897 2898
        }

2899
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2900 2901 2902 2903 2904 2905 2906 2907 2908 2909
        public void TestEnumInConstantField()
        {
            Test(@"public class EnumTest
{
    enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat };
    static void Main()
    {
        const int $$x = (int)Days.Sun;
    }
}",
2910
                MainDescription($"({FeaturesResources.LocalConstant}) int x = (int)Days.Sun"));
2911 2912
        }

2913
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2914 2915 2916 2917 2918 2919 2920 2921 2922 2923
        public void TestConstantInDefaultExpression()
        {
            Test(@"public class EnumTest
{
    enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat };
    static void Main()
    {
        const Days $$x = default(Days);
    }
}",
2924
                MainDescription($"({FeaturesResources.LocalConstant}) Days x = default(Days)"));
2925 2926
        }

2927
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2928 2929 2930
        public void TestConstantParameter()
        {
            Test("class C { void Bar(int $$b = 1); }",
2931
                MainDescription($"({FeaturesResources.Parameter}) int b = 1"));
2932 2933
        }

2934
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2935 2936 2937
        public void TestConstantLocal()
        {
            Test("class C { void Bar() { const int $$loc = 1; }",
2938
                MainDescription($"({FeaturesResources.LocalConstant}) int loc = 1"));
2939 2940 2941
        }

        [WorkItem(544416)]
2942
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2943 2944 2945
        public void TestErrorType1()
        {
            TestInMethod("var $$v1 = new Foo();",
2946
                MainDescription($"({FeaturesResources.LocalVariable}) Foo v1"));
2947 2948 2949
        }

        [WorkItem(544416)]
2950
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2951 2952 2953
        public void TestErrorType2()
        {
            TestInMethod("var $$v1 = v1;",
2954
                MainDescription($"({FeaturesResources.LocalVariable}) var v1"));
2955 2956 2957
        }

        [WorkItem(544416)]
2958
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2959 2960 2961
        public void TestErrorType3()
        {
            TestInMethod("var $$v1 = new Foo<Bar>();",
2962
                MainDescription($"({FeaturesResources.LocalVariable}) Foo<Bar> v1"));
2963 2964 2965
        }

        [WorkItem(544416)]
2966
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2967 2968 2969
        public void TestErrorType4()
        {
            TestInMethod("var $$v1 = &(x => x);",
2970
                MainDescription($"({FeaturesResources.LocalVariable}) ?* v1"));
2971 2972 2973
        }

        [WorkItem(544416)]
2974
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2975 2976 2977
        public void TestErrorType5()
        {
            TestInMethod("var $$v1 = &v1",
2978
                MainDescription($"({FeaturesResources.LocalVariable}) var* v1"));
2979 2980 2981
        }

        [WorkItem(544416)]
2982
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2983 2984 2985
        public void TestErrorType6()
        {
            TestInMethod("var $$v1 = new Foo[1]",
2986
                MainDescription($"({FeaturesResources.LocalVariable}) Foo[] v1"));
2987 2988 2989
        }

        [WorkItem(544416)]
2990
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2991 2992 2993
        public void TestErrorType7()
        {
            TestInClass("class C { void Method() { } void Foo() { var $$v1 = MethodGroup; } }",
2994
                MainDescription($"({FeaturesResources.LocalVariable}) ? v1"));
2995 2996 2997
        }

        [WorkItem(544416)]
2998
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
2999 3000 3001
        public void TestErrorType8()
        {
            TestInMethod("var $$v1 = Unknown",
3002
                MainDescription($"({FeaturesResources.LocalVariable}) ? v1"));
3003 3004 3005
        }

        [WorkItem(545072)]
3006
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3007 3008 3009 3010 3011 3012 3013
        public void TestDelegateSpecialTypes()
        {
            Test("delegate void $$F(int x);",
                MainDescription("delegate void F(int x)"));
        }

        [WorkItem(545108)]
3014
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3015 3016 3017 3018 3019 3020 3021
        public void TestNullPointerParameter()
        {
            Test("class C { unsafe void $$Foo(int* x = null) { } }",
                MainDescription("void C.Foo([int* x = null])"));
        }

        [WorkItem(545098)]
3022
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3023 3024 3025
        public void TestLetIdentifier1()
        {
            TestInMethod("var q = from e in \"\" let $$y = 1 let a = new { y } select a;",
3026
                MainDescription($"({FeaturesResources.RangeVariable}) int y"));
3027 3028 3029
        }

        [WorkItem(545295)]
3030
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3031 3032 3033 3034 3035 3036 3037
        public void TestNullableDefaultValue()
        {
            Test("class Test { void $$Method(int? t1 = null) { } }",
                MainDescription("void Test.Method([int? t1 = null])"));
        }

        [WorkItem(529586)]
3038
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3039 3040 3041 3042 3043 3044
        public void TestInvalidParameterInitializer()
        {
            Test(
@"class Program { void M1(float $$j1 = ""Hello""
        + 
        ""World"") { } }",
3045
                MainDescription($@"({FeaturesResources.Parameter}) float j1 = ""Hello"" + ""World"""));
3046 3047 3048
        }

        [WorkItem(545230)]
3049
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062
        public void TestComplexConstLocal()
        {
            Test(
@"class Program
{
    void Main()
    {
        const int MEGABYTE = 1024 *
            1024 + true;
        Blah($$MEGABYTE);
    }
}
",
3063
                MainDescription($@"({FeaturesResources.LocalConstant}) int MEGABYTE = 1024 * 1024 + true"));
3064 3065 3066
        }

        [WorkItem(545230)]
3067
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080
        public void TestComplexConstField()
        {
            Test(
@"class Program
{
    const int a = true 
        - 
        false;
    void Main()
    {
        Foo($$a);
    }
}",
3081
                MainDescription($"({FeaturesResources.Constant}) int Program.a = true - false"));
3082 3083
        }

3084
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096
        public void TestTypeParameterCrefDoesNotHaveQuickInfo()
        {
            Test(
@"class C<T>
{
    ///  <see cref=""C{X$$}""/>
    static void Main(string[] args)
    {
    }
}");
        }

3097
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110
        public void TestCref1()
        {
            Test(
@"class Program
{
    ///  <see cref=""Mai$$n""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

3111
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124
        public void TestCref2()
        {
            Test(
@"class Program
{
    ///  <see cref=""$$Main""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

3125
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137
        public void TestCref3()
        {
            Test(
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

3138
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150
        public void TestCref4()
        {
            Test(
@"class Program
{
    ///  <see cref=""Main$$""/>
    static void Main(string[] args)
    {
    }
}");
        }

3151
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164
        public void TestCref5()
        {
            Test(
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

        [WorkItem(546849)]
3165
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211
        public void TestIndexedProperty()
        {
            var markup = @"class Program
{
    void M()
    {
            CCC c = new CCC();
            c.Index$$Prop[0] = ""s"";
    }
}";

            // Note that <COMImport> is required by compiler.  Bug 17013 tracks enabling indexed property for non-COM types.
            var referencedCode = @"Imports System.Runtime.InteropServices
<ComImport()>
<GuidAttribute(CCC.ClassId)>
Public Class CCC

#Region ""COM GUIDs""
    Public Const ClassId As String = ""9d965fd2-1514-44f6-accd-257ce77c46b0""
    Public Const InterfaceId As String = ""a9415060-fdf0-47e3-bc80-9c18f7f39cf6""
    Public Const EventsId As String = ""c6a866a5-5f97-4b53-a5df-3739dc8ff1bb""
# End Region

    ''' <summary>
    ''' An index property from VB
    ''' </summary>
    ''' <param name=""p1"">p1 is an integer index</param>
    ''' <returns>A string</returns>
    Public Property IndexProp(ByVal p1 As Integer, Optional ByVal p2 As Integer = 0) As String
        Get
            Return Nothing
        End Get
        Set(ByVal value As String)

        End Set
    End Property
End Class";

            TestWithReference(sourceCode: markup,
                referencedCode: referencedCode,
                sourceLanguage: LanguageNames.CSharp,
                referencedLanguage: LanguageNames.VisualBasic,
                expectedResults: MainDescription("string CCC.IndexProp[int p1, [int p2 = 0]] { get; set; }"));
        }

        [WorkItem(546918)]
3212
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229
        public void TestUnconstructedGeneric()
        {
            Test(
@"class A<T> {
    enum SortOrder {
        Ascending,
        Descending,
        None
    }
    void Foo() {
        var b = $$SortOrder.Ascending;
    }
}",
                MainDescription(@"enum A<T>.SortOrder"));
        }

        [WorkItem(546970)]
3230
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3231 3232 3233 3234 3235 3236 3237 3238 3239 3240
        public void TestUnconstructedGenericInCRef()
        {
            Test(
@"
/// <see cref=""$$C{T}"" />
class C<T> { }
",
                MainDescription(@"class C<T>"));
        }

3241
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3242 3243 3244 3245 3246 3247 3248 3249 3250 3251
        public void TestAwaitableMethod()
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    async Task Foo()
    {
        Fo$$o();
    }
}";
3252
            var description = $"({CSharpFeaturesResources.Awaitable}) Task C.Foo()";
3253

3254
            var documentation = $@"
3255
{WorkspacesResources.Usage}
3256
  {CSharpFeaturesResources.Await} Foo();";
3257 3258 3259 3260

            VerifyWithMscorlib45(markup, new[] { MainDescription(description), Usage(documentation) });
        }

3261
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274
        public void ObsoleteItem()
        {
            var markup = @"
using System;

class Program
{
    [Obsolete]
    public void foo()
    {
        fo$$o();
    }
}";
3275
            Test(markup, MainDescription($"[{CSharpFeaturesResources.Deprecated}] void Program.foo()"));
3276 3277 3278
        }

        [WorkItem(751070)]
3279
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298
        public void DynamicOperator()
        {
            var markup = @"

public class Test
{
    public delegate void NoParam();

    static int Main()
    {
        dynamic x = new object();
        if (((System.Func<dynamic>)(() => (x =$$= null)))())
            return 0;
        return 1;
    }
}";
            Test(markup, MainDescription("dynamic dynamic.operator ==(dynamic left, dynamic right)"));
        }

3299
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310
        public void TextOnlyDocComment()
        {
            Test(@"
/// <summary>
///foo
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

3311
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323
        public void TestTrimConcatMultiLine()
        {
            Test(@"
/// <summary>
/// foo
/// bar
/// </summary>
class C$$
{
}", Documentation("foo bar"));
        }

3324
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336
        public void TestCref()
        {
            Test(@"
/// <summary>
/// <see cref=""C""/>
/// <seealso cref=""C""/>
/// </summary>
class C$$
{
}", Documentation("C C"));
        }

3337
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350
        public void ExcludeTextOutsideSummaryBlock()
        {
            Test(@"
/// red
/// <summary>
/// green
/// </summary>
/// yellow
class C$$
{
}", Documentation("green"));
        }

3351
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362
        public void NewlineAfterPara()
        {
            Test(@"
/// <summary>
/// <para>foo</para>
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

3363
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384
        public void TextOnlyDocComment_Metadata()
        {
            var referenced = @"
/// <summary>
///foo
/// </summary>
public class C
{
}";

            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";
            TestWithMetadataReferenceHelper(code, referenced, "C#", "C#", Documentation("foo"));
        }

3385
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407
        public void TestTrimConcatMultiLine_Metadata()
        {
            var referenced = @"
/// <summary>
/// foo
/// bar
/// </summary>
public class C
{
}";

            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";
            TestWithMetadataReferenceHelper(code, referenced, "C#", "C#", Documentation("foo bar"));
        }

3408
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429
        public void TestCref_Metadata()
        {
            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";

            var referenced = @"/// <summary>
/// <see cref=""C""/>
/// <seealso cref=""C""/>
/// </summary>
public class C
{
}";
            TestWithMetadataReferenceHelper(code, referenced, "C#", "C#", Documentation("C C"));
        }

3430
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453
        public void ExcludeTextOutsideSummaryBlock_Metadata()
        {
            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";

            var referenced = @"
/// red
/// <summary>
/// green
/// </summary>
/// yellow
public class C
{
}";
            TestWithMetadataReferenceHelper(code, referenced, "C#", "C#", Documentation("green"));
        }

3454
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469
        public void Param()
        {
            Test(@"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T>(string[] arg$$s, T otherParam)
    {
    }
}", Documentation("First parameter of C.Foo<T>(string[], T)"));
        }

3470
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495
        public void Param_Metadata()
        {
            var code = @"
class G
{
    void foo()
    {
        C c;
        c.Foo<int>(arg$$s: new string[] { }, 1);
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T>(string[] args, T otherParam)
    {
    }
}";
            TestWithMetadataReferenceHelper(code, referenced, "C#", "C#", Documentation("First parameter of C.Foo<T>(string[], T)"));
        }

3496
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511
        public void Param2()
        {
            Test(@"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T>(string[] args, T oth$$erParam)
    {
    }
}", Documentation("Another parameter of C.Foo<T>(string[], T)"));
        }

3512
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537
        public void Param2_Metadata()
        {
            var code = @"
class G
{
    void foo()
    {
        C c;
        c.Foo<int>(args: new string[] { }, other$$Param: 1);
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
        public void Foo<T>(string[] args, T otherParam)
    {
    }
}";
            TestWithMetadataReferenceHelper(code, referenced, "C#", "C#", Documentation("Another parameter of C.Foo<T>(string[], T)"));
        }

3538
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553
        public void TypeParam()
        {
            Test(@"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""Foo{T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T$$>(string[] args, T otherParam)
    {
    }
}", Documentation("A type parameter of C.Foo<T>(string[], T)"));
        }

3554
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569
        public void UnboundCref()
        {
            Test(@"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{T}(string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T$$>(string[] args, T otherParam)
    {
    }
}", Documentation("A type parameter of foo<T>(string[], T)"));
        }

3570
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584
        public void CrefInConstructor()
        {
            Test(@"
public class TestClass
{
    /// <summary> 
    /// This sample shows how to specify the <see cref=""TestClass""/> constructor as a cref attribute.
    /// </summary> 
    public TestClass$$()
    {
    }
}", Documentation("This sample shows how to specify the TestClass constructor as a cref attribute."));
        }

3585
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606
        public void CrefInConstructorOverloaded()
        {
            Test(@"
public class TestClass
{
    /// <summary> 
    /// This sample shows how to specify the <see cref=""TestClass""/> constructor as a cref attribute.
    /// </summary> 
    public TestClass()
    {
    }

    /// <summary> 
    /// This sample shows how to specify the <see cref=""TestClass(int)""/> constructor as a cref attribute.
    /// </summary> 
    public TestC$$lass(int value)
    { }

    }", Documentation("This sample shows how to specify the TestClass(int) constructor as a cref attribute."));
        }

3607
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621
        public void CrefInGenericMethod1()
        {
            Test(@"
public class TestClass
{
        /// <summary> 
        /// The GetGenericValue method. 
        /// <para>This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute.</para>
        /// </summary> 
        public static T GetGenericVa$$lue<T>(T para) { return para; }

    }", Documentation("The GetGenericValue method.\r\n\r\nThis sample shows how to specify the TestClass.GetGenericValue<T>(T) method as a cref attribute."));
        }

3622
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637
        public void CrefInGenericMethod2()
        {
            Test(@"
public class TestClass
{
        /// <summary> 
        /// The GetGenericValue method. 
        /// <para>This sample shows how to specify the <see cref=""GetGenericValue{T}(T)""/> method as a cref attribute.</para>
        /// </summary> 
        public static T GetGenericVa$$lue<T>(T para) { return para; }

    }", Documentation("The GetGenericValue method.\r\n\r\nThis sample shows how to specify the TestClass.GetGenericValue<T>(T) method as a cref attribute."));
        }

        [WorkItem(813350)]
3638
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663
        public void CrefInMethodOverloading1()
        {
            Test(@"
public class TestClass
{
        public static int GetZero()
        {
            GetGenericValu$$e();
            GetGenericValue(5);
        }

        /// <summary> 
        /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
        /// </summary> 
        public static T GetGenericValue<T>(T para) { return para; }

        /// <summary> 
        /// This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute.
        /// </summary> 
        public static void GetGenericValue() { }

    }", Documentation("This sample shows how to specify the TestClass.GetGenericValue() method as a cref attribute."));
        }

        [WorkItem(813350)]
3664
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688
        public void CrefInMethodOverloading2()
        {
            Test(@"
public class TestClass
{
        public static int GetZero()
        {
            GetGenericValue();
            GetGenericVal$$ue(5);
        }

        /// <summary> 
        /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
        /// </summary> 
        public static T GetGenericValue<T>(T para) { return para; }

        /// <summary> 
        /// This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute.
        /// </summary> 
        public static void GetGenericValue() { }

    }", Documentation("This sample shows how to call the TestClass.GetGenericValue<T>(T) method"));
        }

3689
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709
        public void CrefInGenericType()
        {
            Test(@"
    /// <summary> 
    /// <remarks>This example shows how to specify the <see cref=""GenericClass{T}""/> cref.</remarks>
    /// </summary> 
    class Generic$$Class<T> { }",
    Documentation("This example shows how to specify the GenericClass<T> cref.",
        ExpectedClassifications(
            Text("This example shows how to specify the"),
            WhiteSpace(" "),
            Class("GenericClass"),
            Punctuation.OpenAngle,
            TypeParameter("T"),
            Punctuation.CloseAngle,
            WhiteSpace(" "),
            Text("cref."))));
        }

        [WorkItem(812720)]
3710
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746
        public void ClassificationOfCrefsFromMetadata()
        {
            var code = @"
class G
{
    void foo()
    {
        C c;
        c.Fo$$o();
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
    /// <summary> 
    /// See <see cref=""Foo""/> method
    /// </summary> 
    public void Foo()
    {
    }
}";
            TestWithMetadataReferenceHelper(code, referenced, "C#", "C#",
                Documentation("See C.Foo() method",
                    ExpectedClassifications(
                        Text("See"),
                        WhiteSpace(" "),
                        Class("C"),
                        Punctuation.Text("."),
                        Identifier("Foo"),
                        Punctuation.OpenParen,
                        Punctuation.CloseParen,
                        WhiteSpace(" "),
                        Text("method"))));
        }

3747
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768
        public void FieldAvailableInBothLinkedFiles()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    int x;
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

3769
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.Field}) int C.x"), Usage("") });
3770 3771
        }

3772
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794
        public void FieldUnavailableInOneLinkedFile()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""FOO"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
3795
            var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj2", FeaturesResources.NotAvailable)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}", expectsWarningGlyph: true);
3796 3797 3798 3799

            VerifyWithReferenceWorker(markup, new[] { expectedDescription });
        }

3800
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822
        public void BindSymbolInOtherFile()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""FOO"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
3823
            var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.NotAvailable)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj2", FeaturesResources.Available)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}", expectsWarningGlyph: true);
3824 3825 3826 3827

            VerifyWithReferenceWorker(markup, new[] { expectedDescription });
        }

3828
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854
        public void FieldUnavailableInTwoLinkedFiles()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""FOO"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
            var expectedDescription = Usage(
3855
                $"\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj2", FeaturesResources.NotAvailable)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj3", FeaturesResources.NotAvailable)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}",
3856 3857 3858 3859 3860
                expectsWarningGlyph: true);

            VerifyWithReferenceWorker(markup, new[] { expectedDescription });
        }

3861
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889
        public void ExcludeFilesWithInactiveRegions()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""FOO,BAR"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif

#if BAR
    void foo()
    {
        x$$
    }
#endif
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument"" />
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3"" PreprocessorSymbols=""BAR"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
3890
            var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj3", FeaturesResources.NotAvailable)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}", expectsWarningGlyph: true);
3891 3892 3893 3894
            VerifyWithReferenceWorker(markup, new[] { expectedDescription });
        }

        [WorkItem(962353)]
3895
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922
        public void NoValidSymbolsInLinkedDocuments()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    void foo()
    {
        B$$ar();
    }
#if B
    void Bar() { }
#endif
   
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
            VerifyWithReferenceWorker(markup);
        }

        [WorkItem(1020944)]
3923
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943
        public void LocalsValidInLinkedDocuments()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    void M()
    {
        int x$$;
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

3944
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.LocalVariable}) int x"), Usage("") });
3945 3946 3947
        }

        [WorkItem(1020944)]
3948
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972
        public void LocalWarningInLinkedDocuments()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""PROJ1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    void M()
    {
#if PROJ1
        int x;
#endif

        int y = x$$;
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

3973
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.LocalVariable}) int x"), Usage($"\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj2", FeaturesResources.NotAvailable)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}", expectsWarningGlyph: true) });
3974 3975 3976
        }

        [WorkItem(1020944)]
3977
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997
        public void LabelsValidInLinkedDocuments()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{   
    void M()
    {
        $$LABEL: goto LABEL;
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

3998
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.Label}) LABEL"), Usage("") });
3999 4000 4001
        }

        [WorkItem(1020944)]
4002
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023
        public void RangeVariablesValidInLinkedDocuments()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
using System.Linq;
class C
{
    void M()
    {
        var x = from y in new[] {1, 2, 3} select $$y;
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

4024
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.RangeVariable}) int y"), Usage("") });
4025 4026 4027
        }

        [WorkItem(1019766)]
4028
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044
        public void PointerAccessibility()
        {
            var markup = @"class C
{
    unsafe static void Main()
    {
        void* p = null;
        void* q = null;
        dynamic d = true;
        var x = p =$$= q == d;
    }
}";
            Test(markup, MainDescription("bool void*.operator ==(void* left, void* right)"));
        }

        [WorkItem(1114300)]
4045
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061
        public void AwaitingTaskOfArrayType()
        {
            var markup = @"
using System.Threading.Tasks;

class Program
{
    async Task<int[]> M()
    {
        awa$$it M();
    }
}";
            Test(markup, MainDescription("int[]"));
        }

        [WorkItem(1114300)]
4062
        [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076
        public void AwaitingTaskOfDynamic()
        {
            var markup = @"
using System.Threading.Tasks;

class Program
{
    async Task<dynamic> M()
    {
        awa$$it M();
    }
}";
            Test(markup, MainDescription("dynamic"));
        }
4077

4078
        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106
        public void MethodOverloadDifferencesIgnored()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if ONE
    void Do(int x){}
#endif
#if TWO
    void Do(string x){}
#endif
    void Shared()
    {
        this.Do$$
    }

}]]></Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

            var expectedDescription = $"void C.Do(int x)";
            VerifyWithReferenceWorker(markup, MainDescription(expectedDescription));
        }
4107

4108
        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159
        public void MethodOverloadDifferencesIgnored_ContainingType()
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    void Shared()
    {
        var x = GetThing().Do$$();
    }

#if ONE
    private Methods1 GetThing()
    {
        return new Methods1();
    }
#endif

#if TWO
    private Methods2 GetThing()
    {
        return new Methods2();
    }
#endif
}

#if ONE
public class Methods1
{
    public void Do(string x) { }
}
#endif

#if TWO
public class Methods2
{
    public void Do(string x) { }
}
#endif
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

            var expectedDescription = $"void Methods1.Do(string x)";
            VerifyWithReferenceWorker(markup, MainDescription(expectedDescription));
        }
4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(4868, "https://github.com/dotnet/roslyn/issues/4868")]
        public void QuickInfoExceptions()
        {
            Test(@"
using System;
namespace MyNs
{
    class MyException1 : Exception { }
    class MyException2 : Exception { }
    class TestClass
    {
        /// <exception cref=""MyException1""></exception>
        /// <exception cref=""T:MyNs.MyException2""></exception>
        /// <exception cref=""System.Int32""></exception>
        /// <exception cref=""double""></exception>
4177
        /// <exception cref=""Not_A_Class_But_Still_Displayed""></exception>
4178 4179 4180 4181 4182 4183 4184
        void M()
        {
            M$$();
        }
    }
}
",
4185
                Exceptions($"\r\n{WorkspacesResources.Exceptions}\r\n  MyException1\r\n  MyException2\r\n  int\r\n  double\r\n  Not_A_Class_But_Still_Displayed"));
4186
        }
4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(1516, "https://github.com/dotnet/roslyn/issues/1516")]
        public void QuickInfoWithNonStandardSeeAttributesAppear()
        {
            Test(@"
class C
{
    /// <summary>
    /// <see cref=""System.String"" />
    /// <see href=""http://microsoft.com"" />
    /// <see langword=""null"" />
    /// <see unsupported-attribute=""cat"" />
    /// </summary>
    void M()
    {
        M$$();
    }
}
",
                Documentation(@"string http://microsoft.com null cat"));
        }
4209 4210
    }
}