SemanticQuickInfoSourceTests.cs 117.7 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 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 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 445 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 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615
// 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);
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestNamespaceInUsingDirective()
        {
            Test("using $$System;",
                MainDescription("namespace System"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestNamespaceInUsingDirective2()
        {
            Test("using System.Coll$$ections.Generic;",
                MainDescription("namespace System.Collections"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestNamespaceInUsingDirective3()
        {
            Test("using System.L$$inq;",
                MainDescription("namespace System.Linq"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestNamespaceInUsingDirectiveWithAlias()
        {
            Test("using Foo = Sys$$tem.Console;",
                MainDescription("namespace System"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTypeInUsingDirectiveWithAlias()
        {
            Test("using Foo = System.Con$$sole;",
                MainDescription("class System.Console"));
        }

        [WorkItem(991466)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestClassWithDocComment()
        {
            var markup =
@"
///<summary>Hello!</summary>
class C { void M() { $$C obj; } }";

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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!"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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!"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestMethodWithDocComment()
        {
            var markup =
@"
///<summary>Hello!</summary>
void M() { M$$() }";

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestInt32()
        {
            TestInClass(@"$$Int32 i;",
                MainDescription("struct System.Int32"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestBuiltInInt()
        {
            TestInClass(@"$$int i;",
                MainDescription("struct System.Int32"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestString()
        {
            TestInClass(@"$$String s;",
                MainDescription("class System.String"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestBuiltInString()
        {
            TestInClass(@"$$string s;",
                MainDescription("class System.String"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestBuiltInStringAtEndOfToken()
        {
            TestInClass(@"string$$ s;",
                MainDescription("class System.String"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestBoolean()
        {
            TestInClass(@"$$Boolean b;",
                MainDescription("struct System.Boolean"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestBuiltInBool()
        {
            TestInClass(@"$$bool b;",
                MainDescription("struct System.Boolean"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestSingle()
        {
            TestInClass(@"$$Single s;",
                MainDescription("struct System.Single"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestBuiltInFloat()
        {
            TestInClass(@"$$float f;",
                MainDescription("struct System.Single"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestVoidIsInvalid()
        {
            TestInvalidTypeInClass(@"$$void M() { }");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestInvalidPointer1_931958()
        {
            TestInvalidTypeInClass(@"$$T* i;");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestInvalidPointer2_931958()
        {
            TestInvalidTypeInClass(@"T$$* i;");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestInvalidPointer3_931958()
        {
            TestInvalidTypeInClass(@"T*$$ i;");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestListOfString()
        {
            TestInClass(@"$$List<string> l;",
                MainDescription("class System.Collections.Generic.List<T>"),
616
                TypeParameterMap($"\r\nT {FeaturesResources.Is} string"));
617 618 619 620 621 622 623 624 625 626 627 628 629
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 634 635 636 637 638 639 640 641 642 643 644 645
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestListOfT()
        {
            TestWithUsings(@"class C<T> { $$List<T> l; }",
                MainDescription("class System.Collections.Generic.List<T>"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 651 652 653 654 655
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 661 662 663 664
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 669 670 671 672 673 674 675 676 677 678
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestEventHandler()
        {
            TestInClass(@"event $$EventHandler e;",
                MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTypeParameter()
        {
            Test(@"class C<T> { $$T t; }",
679
                MainDescription($"T {FeaturesResources.In} C<T>"));
680 681 682 683 684 685 686 687 688 689 690 691 692
        }

        [WorkItem(538636)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 697 698 699 700
                Documentation("T is Type Parameter"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTypeParameter1_Bug931949()
        {
            Test(@"class T1<T11> { $$T11 t; }",
701
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
702 703 704 705 706 707
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTypeParameter2_Bug931949()
        {
            Test(@"class T1<T11> { T$$11 t; }",
708
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
709 710 711 712 713 714
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTypeParameter3_Bug931949()
        {
            Test(@"class T1<T11> { T1$$1 t; }",
715
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
716 717 718 719 720 721
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTypeParameter4_Bug931949()
        {
            Test(@"class T1<T11> { T11$$ t; }",
722
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
723 724 725 726 727 728 729
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 734 735 736
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 741 742 743
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 748 749 750
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 755 756 757
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestGenericTypeParameterConstraint_Class()
        {
            Test(@"class C<T> where $$T : class { }",
758
                MainDescription($"T {FeaturesResources.In} C<T> where T : class"));
759 760 761 762 763 764
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestGenericTypeParameterConstraint_Struct()
        {
            Test(@"struct S<T> where $$T : class { }",
765
                MainDescription($"T {FeaturesResources.In} S<T> where T : class"));
766 767 768 769 770 771
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestGenericTypeParameterConstraint_Interface()
        {
            Test(@"interface I<T> where $$T : class { }",
772
                MainDescription($"T {FeaturesResources.In} I<T> where T : class"));
773 774 775 776 777 778
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 783 784 785
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 790 791 792
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestMethodReferenceInSameMethod()
        {
            Test("class C { void M() { M$$(); } }",
                MainDescription("void C.M()"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestMethodReferenceInSameMethodWithDocComment()
        {
            var markup =
@"
///<summary>Hello World</summary>
void M() { M$$(); }";

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestFieldInMethodBuiltIn()
        {
            var markup =
@"int field;

void M()
{
    field$$
}";

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestFieldInMethodBuiltIn2()
        {
            TestInClass("int field; void M() { int f = field$$; }",
835
                MainDescription($"({FeaturesResources.Field}) int C.field"));
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestFieldInMethodBuiltInWithFieldInitializer()
        {
            TestInClass("int field = 1; void M() { int f = field $$; }");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOperatorBuiltIn()
        {
            TestInMethod("int x; x = x$$+1;",
                MainDescription("int int.operator +(int left, int right)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOperatorBuiltIn1()
        {
            TestInMethod("int x; x = x$$ + 1;",
855
                MainDescription($"({FeaturesResources.LocalVariable}) int x"));
856 857 858 859 860 861
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOperatorBuiltIn2()
        {
            TestInMethod("int x; x = x+$$x;",
862
                MainDescription($"({FeaturesResources.LocalVariable}) int x"));
863 864 865 866 867 868 869 870 871 872 873 874 875
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOperatorBuiltIn3()
        {
            TestInMethod("int x; x = x +$$ x;",
                MainDescription("int int.operator +(int left, int right)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOperatorBuiltIn4()
        {
            TestInMethod("int x; x = x + $$x;",
876
                MainDescription($"({FeaturesResources.LocalVariable}) int x"));
877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOperatorCustomTypeBuiltIn()
        {
            var markup =
@"class C
{
    static void M() { C c; c = c +$$ c; }
}";

            Test(markup);
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestFieldInMethodMinimal()
        {
            var markup =
@"DateTime field;

void M()
{
    field$$
}";

            TestInClass(markup,
917
                MainDescription($"({FeaturesResources.Field}) DateTime C.field"));
918 919 920 921 922 923 924 925 926 927 928 929 930 931
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 936 937 938 939 940 941 942 943
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 948 949 950 951 952 953 954 955 956 957
        }

        [WorkItem(538638)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 962 963 964 965 966 967 968 969 970
                Documentation("My Field"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 975 976 977 978 979 980 981 982 983 984
        }

        [WorkItem(538638)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 989 990 991 992
                Documentation("My Field"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestMetadataFieldMinimal()
        {
            TestInMethod(@"DateTime dt = DateTime.MaxValue$$",
993
                MainDescription($"({FeaturesResources.Field}) DateTime DateTime.MaxValue"));
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1012 1013 1014 1015 1016 1017 1018 1019 1020
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1039 1040 1041 1042 1043 1044 1045 1046 1047
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestIntegerLiteral()
        {
            TestInMethod(@"int f = 37$$",
                MainDescription("struct System.Int32"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTrueKeyword()
        {
            TestInMethod(@"bool f = true$$",
                MainDescription("struct System.Boolean"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestFalseKeyword()
        {
            TestInMethod(@"bool f = false$$",
                MainDescription("struct System.Boolean"));
        }

        [WorkItem(756226)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114
        }

        [WorkItem(756226)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
        }

        [WorkItem(756226)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1134 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
        }

        [WorkItem(756226), WorkItem(756337)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1170 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
        }

        [WorkItem(756226)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227
        }

        [WorkItem(756226), WorkItem(756337)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242
        }

        [WorkItem(756226), WorkItem(756337)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258
        }

        [WorkItem(756226), WorkItem(756337)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestStringLiteral()
        {
            TestInMethod(@"string f = ""Foo""$$",
                MainDescription("class System.String"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestCharLiteral()
        {
            TestInMethod(@"string f = 'x'$$",
                MainDescription("struct System.Char"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void DynamicKeyword()
        {
            TestInMethod(@"dyn$$amic dyn;",
                MainDescription("dynamic"),
1282
                Documentation(FeaturesResources.RepresentsAnObjectWhoseOperations));
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void DynamicField()
        {
            TestInClass(@"dynamic dyn;
void M()
{
    d$$yn.Foo();
}",
1293
                MainDescription($"({FeaturesResources.Field}) dynamic C.dyn"));
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void LocalProperty_Minimal()
        {
            TestInClass(@"DateTime Prop { get; set; }
void M()
{
    P$$rop.ToString();
}",
                MainDescription("DateTime C.Prop { get; set; }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void LocalProperty_Qualified()
        {
            TestInClass(@"System.IO.FileInfo Prop { get; set; }
void M()
{
    P$$rop.ToString();
}",
                MainDescription("System.IO.FileInfo C.Prop { get; set; }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void NonLocalProperty_Minimal()
        {
            TestInMethod(@"DateTime.No$$w.ToString();",
                MainDescription("DateTime DateTime.Now { get; }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void NonLocalProperty_Qualified()
        {
            TestInMethod(@"System.IO.FileInfo f; f.Att$$ributes.ToString();",
                MainDescription("System.IO.FileAttributes System.IO.FileSystemInfo.Attributes { get; set; }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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; }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void UnconstructedGenericProperty()
        {
            Test(@"
class C<T> {
    public T Property { get; set}

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void ValueInProperty()
        {
            TestInClass(@"public DateTime Property {set { foo = val$$ue; } }",
1366
                MainDescription($"({FeaturesResources.Parameter}) DateTime value"));
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void EnumTypeName()
        {
            TestInMethod(@"Consol$$eColor c",
                MainDescription("enum System.ConsoleColor"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void EnumMemberNameFromMetadata()
        {
            TestInMethod(@"ConsoleColor c = ConsoleColor.Bla$$ck",
                MainDescription("ConsoleColor.Black = 0"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void FlagsEnumMemberNameFromMetadata1()
        {
            TestInMethod(@"AttributeTargets a = AttributeTargets.Cl$$ass",
                MainDescription("AttributeTargets.Class = 4"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void EnumMemberNameFromSource2()
        {
            Test(@"
enum E
{
    A,
    B,
    C
}

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Parameter_InMethod_Minimal()
        {
            TestInClass(@"void M(DateTime dt) { d$$t.ToString();",
1443
                MainDescription($"({FeaturesResources.Parameter}) DateTime dt"));
1444 1445 1446 1447 1448 1449
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Parameter_InMethod_Qualified()
        {
            TestInClass(@"void M(System.IO.FileInfo fileInfo) { file$$Info.ToString();",
1450
                MainDescription($"({FeaturesResources.Parameter}) System.IO.FileInfo fileInfo"));
1451 1452 1453 1454 1455 1456
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Parameter_FromReferenceToNamedParameter()
        {
            TestInMethod(@"Console.WriteLine(va$$lue: ""Hi"");",
1457
                MainDescription($"({FeaturesResources.Parameter}) string value"));
1458 1459 1460 1461 1462 1463 1464 1465
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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(); }",
1466
                MainDescription($"({FeaturesResources.Parameter}) int param = 42"));
1467 1468 1469 1470 1471 1472
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Parameter_Params()
        {
            TestInClass(@"void M(params DateTime[] arg) { ar$$g.ToString(); }",
1473
                MainDescription($"({FeaturesResources.Parameter}) params DateTime[] arg"));
1474 1475 1476 1477 1478 1479
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Parameter_Ref()
        {
            TestInClass(@"void M(ref DateTime arg) { ar$$g.ToString(); }",
1480
                MainDescription($"({FeaturesResources.Parameter}) ref DateTime arg"));
1481 1482 1483 1484 1485 1486
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Parameter_Out()
        {
            TestInClass(@"void M(out DateTime arg) { ar$$g.ToString(); }",
1487
                MainDescription($"({FeaturesResources.Parameter}) out DateTime arg"));
1488 1489 1490 1491 1492 1493
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Local_Minimal()
        {
            TestInMethod(@"DateTime dt; d$$t.ToString();",
1494
                MainDescription($"({FeaturesResources.LocalVariable}) DateTime dt"));
1495 1496 1497 1498 1499 1500
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Local_Qualified()
        {
            TestInMethod(@"System.IO.FileInfo fileInfo; file$$Info.ToString();",
1501
                MainDescription($"({FeaturesResources.LocalVariable}) System.IO.FileInfo fileInfo"));
1502 1503 1504 1505 1506 1507
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Method_MetadataOverload()
        {
            TestInMethod("Console.Write$$Line();",
1508
                MainDescription($"void Console.WriteLine() (+ 18 {FeaturesResources.Overloads})"));
1509 1510 1511 1512 1513 1514 1515 1516
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Method_SimpleWithOverload()
        {
            TestInClass(@"
void Method() { Met$$hod(); }
void Method(int i) { }",
1517
                MainDescription($"void C.Method() (+ 1 {FeaturesResources.Overload})"));
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Method_MoreOverloads()
        {
            TestInClass(@"
void Method() { Met$$hod(null); }
void Method(int i) { }
void Method(DateTime dt) { }
void Method(System.IO.FileInfo fileInfo) { }",
1528
                MainDescription($"void C.Method(System.IO.FileInfo fileInfo) (+ 3 {FeaturesResources.Overloads})"));
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Method_SimpleInSameClass()
        {
            TestInClass(@"DateTime GetDate(System.IO.FileInfo ft) { Get$$Date(null); }",
                MainDescription("DateTime C.GetDate(System.IO.FileInfo ft)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Method_OptionalParameter()
        {
            TestInClass(@"
void M() { Met$$hod(); }
void Method(int i = 0) { }",
                MainDescription("void C.Method([int i = 0])"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Method_OptionalDecimalParameter()
        {
            TestInClass(@"
void Foo(decimal x$$yz = 10) { }",
1552
                MainDescription($"({FeaturesResources.Parameter}) decimal xyz = 10"));
1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Method_Inferred()
        {
            TestInClass(@"void Foo<TIn>(TIn arg) {
    Fo$$o(42);
}",
                MainDescription("void C.Foo<int>(int arg)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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])"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Constructor()
        {
            TestInClass(@"public C() {} void M() { new C$$ ().ToString(); }",
                MainDescription("C.C()"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Constructor_Overloads()
        {
            TestInClass(@"
public C() {}
public C(DateTime dt) {}
public C(int i) {}

void M()
{
    new C$$ (DateTime.MaxValue).ToString();
}",
1634
                MainDescription($"C.C(DateTime dt) (+ 2 {FeaturesResources.Overloads})"));
1635 1636 1637 1638 1639 1640 1641 1642 1643
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Constructor_OverloadFromStringLiteral()
        {
            TestInMethod(@"new InvalidOperatio$$nException("""");",
1644
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.Overloads})"));
1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Constructor_UnknownType()
        {
            TestInvalidTypeInClass(@"void M() { new F$$oo(); }");
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Constructor_OverloadFromProperty()
        {
            TestInMethod(@"new InvalidOperatio$$nException(this.GetType().Name);",
1663
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.Overloads})"));
1664 1665 1666 1667 1668 1669
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Constructor_Metadata()
        {
            TestInMethod(@"new Argument$$NullException();",
1670
                MainDescription($"ArgumentNullException.ArgumentNullException() (+ 3 {FeaturesResources.Overloads})"));
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Constructor_MetadataQualified()
        {
            TestInMethod(@"new System.IO.File$$Info(null);",
                MainDescription("System.IO.FileInfo.FileInfo(string fileName)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void InterfaceProperty()
        {
            TestInMethod(@"
interface I
{
    string Name$$ { get; set; }
}",
                MainDescription("string I.Name { get; set; }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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; }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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()"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void GenericType()
        {
            Test(@"
class T1<T11>
{
    $$T11 i;
}
",
1783
                MainDescription($"T11 {FeaturesResources.In} T1<T11>"));
1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void GenericMethod()
        {
            TestInClass(@"
    static void Meth1<T1>(T1 i) where T1 : struct
    {
        $$T1 i;
    }
",
1795
                MainDescription($"T1 {FeaturesResources.In} C.Meth1<T1> where T1 : struct"));
1796 1797 1798 1799 1800 1801 1802 1803 1804
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Var()
        {
            TestInMethod(@"
var x = new Exception();
var y = $$x;
",
1805
                MainDescription($"({FeaturesResources.LocalVariable}) Exception x"));
1806 1807 1808 1809 1810 1811 1812 1813 1814
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void NestedInGeneric()
        {
            TestInMethod(@"
            List<int>.Enu$$merator e;
",
                MainDescription("struct System.Collections.Generic.List<T>.Enumerator"),
1815
                TypeParameterMap($"\r\nT {FeaturesResources.Is} int"));
1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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(
1836 1837
                    Lines($"\r\nT {FeaturesResources.Is} int",
                          $"U {FeaturesResources.Is} string")));
1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void ObjectInitializer1()
        {
            TestInClass(@"
    void M()
    {
        var x = new test() { $$z = 5 };
    }

    class test
    {
        public int z;
    }
",
1854
                MainDescription($"({FeaturesResources.Field}) int test.z"));
1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void ObjectInitializer2()
        {
            TestWithUsings(@"
class C
{
    void M()
    {
        var x = new test() { z = $$5 };
    }

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(537880)]
        public void TypeArgument()
        {
            Test(@"
class C<T, Y>
{
    void M()
    {
        C<int, DateTime> variable;
        $$variable = new C<int, DateTime>();
    }
}",
1890
                MainDescription($"({FeaturesResources.LocalVariable}) C<int, DateTime> variable"));
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
}
",
1904
                MainDescription($"({FeaturesResources.LocalVariable}) int cc"));
1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TryCatchFinally_1()
        {
            TestInMethod(@"
            try
            {
                int aa = 555;
                a$$a = aa + 1;
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }",
1922
                MainDescription($"({FeaturesResources.LocalVariable}) int aa"));
1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TryCatchFinally_2()
        {
            TestInMethod(@"
            try
            {
            }
            catch (Exception ex)
            {
                var y = e$$x;
                var z = y;
            }
            finally
            {
            }
",
1941
                MainDescription($"({FeaturesResources.LocalVariable}) Exception ex"));
1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959
        }

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TryCatchFinally_4()
        {
            TestInMethod(@"
            try
            {
            }
            catch (Exception ex)
            {
            }
            finally
            {
                int aa = 555;
                aa = a$$a + 1;
            }
",
1979
                MainDescription($"({FeaturesResources.LocalVariable}) int aa"));
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void GenericVariable()
        {
            Test(@"
            class C<T, Y>
            {
                void M()
                {
                    C<int, DateTime> variable;
                    var$$iable = new C<int, DateTime>();
                }
            }
",
1995
                MainDescription($"({FeaturesResources.LocalVariable}) C<int, DateTime> variable"));
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestInstantiation()
        {
            Test(@"
using System.Collections.Generic;
class Program<T>
{
    static void Main(string[] args)
    {
        var p = new Dictio$$nary<int, string>();
    }
}",
2010
                MainDescription($"Dictionary<int, string>.Dictionary() (+ 5 {FeaturesResources.Overloads})"));
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestUsingAlias_Bug4141()
        {
            Test(@"using X = A.C;
class A {
public class C { }
}
class D : X$$ { }
",
                MainDescription(@"class A.C"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestFieldOnDeclaration()
        {
            TestInClass(@"
DateTime fie$$ld;",
2030
                MainDescription($"({FeaturesResources.Field}) DateTime C.field"));
2031 2032 2033 2034 2035 2036 2037 2038
        }

        [WorkItem(538767)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestGenericErrorFieldOnDeclaration()
        {
            TestInClass(@"
NonExistentType<int> fi$$eld;",
2039
                MainDescription($"({FeaturesResources.Field}) NonExistentType<int> C.field"));
2040 2041 2042 2043 2044 2045 2046 2047 2048 2049
        }

        [WorkItem(538822)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestDelegateType()
        {
            TestInClass(@"
Fun$$c<int, string> field;",
                MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"),
                TypeParameterMap(
2050 2051
                    Lines($"\r\nT {FeaturesResources.Is} int",
                          $"TResult {FeaturesResources.Is} string")));
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068
        }

        [WorkItem(538824)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOnDelegateInvocation()
        {
            Test(@"
class Program
{
    delegate void D1();
    static void Main()
    {
        D1 d = Main;
        $$d(); 
    }
}
",
2069
                MainDescription($"({FeaturesResources.LocalVariable}) D1 d"));
2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163
        }

        [WorkItem(539240)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOnArrayCreation1()
        {
            Test(@"
class Program
{
    static void Main()
    {
        int[] a = n$$ew int[0];
    }
}");
        }

        [WorkItem(539240)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestOnArrayCreation2()
        {
            Test(@"
class Program
{
    static void Main()
    {
        int[] a = new i$$nt[0];
    }
}",
                MainDescription("struct System.Int32"));
        }

        [WorkItem(539841)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType()
        {
            Test(@"using Foo = Foo;
class C
{
    void Main()
    {
        $$Foo
    }
}",
                MainDescription("Foo"));
        }

        [WorkItem(540871)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorInForeach()
        {
            Test(@"
class C
{
    void Main()
    {
        foreach (int cc in null)
        {
            $$cc = 1;
        }
    }
}",
2164
                MainDescription($"({FeaturesResources.LocalVariable}) int cc"));
2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 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
        }

        [WorkItem(540438)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestNoQuickInfoOnAnonymousDelegate()
        {
            Test(@"
using System;

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

        [WorkItem(541678)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestEvent()
        {
            TestInMethod(@"System.Console.CancelKeyPres$$s += null;",
                MainDescription("ConsoleCancelEventHandler Console.CancelKeyPress"));
        }

        [WorkItem(542157)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestEventPlusEqualsOperator()
        {
            TestInMethod(@"System.Console.CancelKeyPress +$$= null;",
                MainDescription("void Console.CancelKeyPress.add"));
        }

        [WorkItem(542157)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestEventMinusEqualsOperator()
        {
            TestInMethod(@"System.Console.CancelKeyPress -$$= null;",
                MainDescription("void Console.CancelKeyPress.remove"));
        }

        [WorkItem(541885)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2260
                MainDescription($"({CSharpFeaturesResources.Extension}) bool int.In<int>(IEnumerable<int> items)"));
2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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) { }
}
",
2285
                MainDescription($"({CSharpFeaturesResources.Extension}) void string.TestExt<string>() (+ 2 {FeaturesResources.Overloads})"));
2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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) { }
}
",
2310
                MainDescription($"({CSharpFeaturesResources.Extension}) void string.TestExt<string>() (+ 1 {FeaturesResources.Overload})"));
2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2327
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2344
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Query3()
        {
            Test(@"
class C
{
    void M()
    {
        var q = from n in new int[] { 1, 2, 3, 4, 5}
                select $$n;
    }
}
",
2360
                MainDescription($"({FeaturesResources.RangeVariable}) ? n"));
2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void Query4()
        {
            Test(@"
class C
{
    void M()
    {
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5}
                select n;
    }
}
",
2376
                MainDescription($"({FeaturesResources.RangeVariable}) ? n"));
2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2394
                MainDescription($"({FeaturesResources.RangeVariable}) object n"));
2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2412
                MainDescription($"({FeaturesResources.RangeVariable}) object n"));
2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2430
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2448
                MainDescription($"({FeaturesResources.RangeVariable}) int n"));
2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2467
                MainDescription($"({FeaturesResources.RangeVariable}) List<int> x"));
2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2486
                MainDescription($"({FeaturesResources.RangeVariable}) List<int> x"));
2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2505
                MainDescription($"({FeaturesResources.RangeVariable}) int y"));
2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}
",
2524
                MainDescription($"({FeaturesResources.RangeVariable}) int y"));
2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552
        }

        [WorkItem(543205)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorGlobal()
        {
            Test(@"extern alias global;
 
class myClass
{
    static int Main()
    {
        $$global::otherClass oc = new global::otherClass();
        return 0;
    }
}",
                MainDescription("<global namespace>"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void DontRemoveAttributeSuffixAndProduceInvalidIdentifier1()
        {
            Test(@"
using System;
class classAttribute : Attribute
{
    private classAttribute x$$;
}",
2553
                MainDescription($"({FeaturesResources.Field}) classAttribute classAttribute.x"));
2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565
        }

        [WorkItem(544026)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void DontRemoveAttributeSuffix2()
        {
            Test(@"
using System;
class class1Attribute : Attribute
{
    private class1Attribute x$$;
}",
2566
                MainDescription($"({FeaturesResources.Field}) class1Attribute class1Attribute.x"));
2567 2568 2569 2570 2571 2572
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestLabel()
        {
            TestInClass(@"void M() { Foo: int Foo; goto Foo$$; }",
2573
                MainDescription($"({FeaturesResources.Label}) Foo"));
2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608
        }

        [WorkItem(542613)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestAnonymousTypeNew1()
        {
            Test(@"
class C
{
    void M()
    {
        var v = $$new { };
    }
}",
                MainDescription(@"AnonymousType 'a"),
                NoTypeParameterMap,
                AnonymousTypes(
2609 2610 2611
$@"
{FeaturesResources.AnonymousTypes}
    'a {FeaturesResources.Is} new {{  }}"));
2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623
        }

        [WorkItem(543873)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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(
2624 2625 2626 2627
$@"
{FeaturesResources.AnonymousTypes}
    'a {FeaturesResources.Is} new {{ string Name, 'b Address }}
    'b {FeaturesResources.Is} new {{ string Street, string Zip }}"));
2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661

            // 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(
@"
Anonymous Types:
    'a is new { string Name, 'b Address }
    'b is new { string Street, string Zip }"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(543183)]
        public void TestAssignmentOperatorInAnonymousType()
        {
            Test(@"class C
{
    void M()
    {
        var a = new { A $$= 0 };
    }
}
");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [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(
2662 2663 2664
$@"
{FeaturesResources.AnonymousTypes}
    'a {FeaturesResources.Is} new {{ int N }}"));
2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(543553)]
        public void TestArrayAssignedToVar()
        {
            Test(@"class C
{
    static void M(string[] args)
    {
        v$$ar a = args;
    }
}
",
                MainDescription("string[]"));
        }

        [WorkItem(529139)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
            }
        }
    }
}
",
2705
                MainDescription($"({FeaturesResources.RangeVariable}) N1.yield yield"));
2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739
        }

        [WorkItem(543550)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestConstantField()
        {
            Test("class C { const int $$F = 1;",
2740
                MainDescription($"({FeaturesResources.Constant}) int C.F = 1"));
2741 2742 2743 2744 2745 2746
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestMultipleConstantFields()
        {
            Test("class C { public const double X = 1.0, Y = 2.0, $$Z = 3.5;",
2747
                MainDescription($"({FeaturesResources.Constant}) double C.Z = 3.5"));
2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
}",
2762
                MainDescription($"({FeaturesResources.Constant}) int A.X = B.Z + 1"));
2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestConstantCircularDependencies()
        {
            Test(@"class A
{
    public const int X = B.Z + 1;
}
class B
{
    public const int Z$$ = A.X + 1;
}",
2776
                MainDescription($"({FeaturesResources.Constant}) int B.Z = A.X + 1"));
2777 2778 2779 2780 2781 2782 2783 2784 2785 2786
        }

        [WorkItem(544620)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestConstantOverflow()
        {
            Test(@"class B
{
    public const int Z$$ = int.MaxValue + 1;
}",
2787
                MainDescription($"({FeaturesResources.Constant}) int B.Z = int.MaxValue + 1"));
2788 2789 2790 2791 2792 2793 2794 2795 2796 2797
        }

        [WorkItem(544620)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestConstantOverflowInUncheckedContext()
        {
            Test(@"class B
{
    public const int Z$$ = unchecked(int.MaxValue + 1);
}",
2798
                MainDescription($"({FeaturesResources.Constant}) int B.Z = unchecked(int.MaxValue + 1)"));
2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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;
    }
}",
2812
                MainDescription($"({FeaturesResources.LocalConstant}) int x = (int)Days.Sun"));
2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestConstantInDefaultExpression()
        {
            Test(@"public class EnumTest
{
    enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat };
    static void Main()
    {
        const Days $$x = default(Days);
    }
}",
2826
                MainDescription($"({FeaturesResources.LocalConstant}) Days x = default(Days)"));
2827 2828 2829 2830 2831 2832
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestConstantParameter()
        {
            Test("class C { void Bar(int $$b = 1); }",
2833
                MainDescription($"({FeaturesResources.Parameter}) int b = 1"));
2834 2835 2836 2837 2838 2839
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestConstantLocal()
        {
            Test("class C { void Bar() { const int $$loc = 1; }",
2840
                MainDescription($"({FeaturesResources.LocalConstant}) int loc = 1"));
2841 2842 2843 2844 2845 2846 2847
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType1()
        {
            TestInMethod("var $$v1 = new Foo();",
2848
                MainDescription($"({FeaturesResources.LocalVariable}) Foo v1"));
2849 2850 2851 2852 2853 2854 2855
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType2()
        {
            TestInMethod("var $$v1 = v1;",
2856
                MainDescription($"({FeaturesResources.LocalVariable}) var v1"));
2857 2858 2859 2860 2861 2862 2863
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType3()
        {
            TestInMethod("var $$v1 = new Foo<Bar>();",
2864
                MainDescription($"({FeaturesResources.LocalVariable}) Foo<Bar> v1"));
2865 2866 2867 2868 2869 2870 2871
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType4()
        {
            TestInMethod("var $$v1 = &(x => x);",
2872
                MainDescription($"({FeaturesResources.LocalVariable}) ?* v1"));
2873 2874 2875 2876 2877 2878 2879
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType5()
        {
            TestInMethod("var $$v1 = &v1",
2880
                MainDescription($"({FeaturesResources.LocalVariable}) var* v1"));
2881 2882 2883 2884 2885 2886 2887
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType6()
        {
            TestInMethod("var $$v1 = new Foo[1]",
2888
                MainDescription($"({FeaturesResources.LocalVariable}) Foo[] v1"));
2889 2890 2891 2892 2893 2894 2895
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType7()
        {
            TestInClass("class C { void Method() { } void Foo() { var $$v1 = MethodGroup; } }",
2896
                MainDescription($"({FeaturesResources.LocalVariable}) ? v1"));
2897 2898 2899 2900 2901 2902 2903
        }

        [WorkItem(544416)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestErrorType8()
        {
            TestInMethod("var $$v1 = Unknown",
2904
                MainDescription($"({FeaturesResources.LocalVariable}) ? v1"));
2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927
        }

        [WorkItem(545072)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestDelegateSpecialTypes()
        {
            Test("delegate void $$F(int x);",
                MainDescription("delegate void F(int x)"));
        }

        [WorkItem(545108)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestNullPointerParameter()
        {
            Test("class C { unsafe void $$Foo(int* x = null) { } }",
                MainDescription("void C.Foo([int* x = null])"));
        }

        [WorkItem(545098)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestLetIdentifier1()
        {
            TestInMethod("var q = from e in \"\" let $$y = 1 let a = new { y } select a;",
2928
                MainDescription($"({FeaturesResources.RangeVariable}) int y"));
2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946
        }

        [WorkItem(545295)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestNullableDefaultValue()
        {
            Test("class Test { void $$Method(int? t1 = null) { } }",
                MainDescription("void Test.Method([int? t1 = null])"));
        }

        [WorkItem(529586)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestInvalidParameterInitializer()
        {
            Test(
@"class Program { void M1(float $$j1 = ""Hello""
        + 
        ""World"") { } }",
2947
                MainDescription($@"({FeaturesResources.Parameter}) float j1 = ""Hello"" + ""World"""));
2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964
        }

        [WorkItem(545230)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestComplexConstLocal()
        {
            Test(
@"class Program
{
    void Main()
    {
        const int MEGABYTE = 1024 *
            1024 + true;
        Blah($$MEGABYTE);
    }
}
",
2965
                MainDescription($@"({FeaturesResources.LocalConstant}) int MEGABYTE = 1024 * 1024 + true"));
2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982
        }

        [WorkItem(545230)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestComplexConstField()
        {
            Test(
@"class Program
{
    const int a = true 
        - 
        false;
    void Main()
    {
        Foo($$a);
    }
}",
2983
                MainDescription($"({FeaturesResources.Constant}) int Program.a = true - false"));
2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTypeParameterCrefDoesNotHaveQuickInfo()
        {
            Test(
@"class C<T>
{
    ///  <see cref=""C{X$$}""/>
    static void Main(string[] args)
    {
    }
}");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestCref1()
        {
            Test(
@"class Program
{
    ///  <see cref=""Mai$$n""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestCref2()
        {
            Test(
@"class Program
{
    ///  <see cref=""$$Main""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestCref3()
        {
            Test(
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestCref4()
        {
            Test(
@"class Program
{
    ///  <see cref=""Main$$""/>
    static void Main(string[] args)
    {
    }
}");
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestCref5()
        {
            Test(
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

        [WorkItem(546849)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestUnconstructedGenericInCRef()
        {
            Test(
@"
/// <see cref=""$$C{T}"" />
class C<T> { }
",
                MainDescription(@"class C<T>"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestAwaitableMethod()
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    async Task Foo()
    {
        Fo$$o();
    }
}";
3154
            var description = $"({CSharpFeaturesResources.Awaitable}) Task C.Foo()";
3155

3156
            var documentation = $@"
3157
{WorkspacesResources.Usage}
3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176
  await Foo();";

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void ObsoleteItem()
        {
            var markup = @"
using System;

class Program
{
    [Obsolete]
    public void foo()
    {
        fo$$o();
    }
}";
3177
            Test(markup, MainDescription($"[{CSharpFeaturesResources.Deprecated}] void Program.foo()"));
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 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 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 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 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 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 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 3664 3665 3666 3667 3668 3669 3670
        }

        [WorkItem(751070)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TextOnlyDocComment()
        {
            Test(@"
/// <summary>
///foo
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestTrimConcatMultiLine()
        {
            Test(@"
/// <summary>
/// foo
/// bar
/// </summary>
class C$$
{
}", Documentation("foo bar"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void TestCref()
        {
            Test(@"
/// <summary>
/// <see cref=""C""/>
/// <seealso cref=""C""/>
/// </summary>
class C$$
{
}", Documentation("C C"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void ExcludeTextOutsideSummaryBlock()
        {
            Test(@"
/// red
/// <summary>
/// green
/// </summary>
/// yellow
class C$$
{
}", Documentation("green"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void NewlineAfterPara()
        {
            Test(@"
/// <summary>
/// <para>foo</para>
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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."));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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."));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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."));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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"))));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";

3671
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.Field}) int C.x"), Usage("") });
3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";
3697
            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);
3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";
3725
            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);
3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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(
3757
                $"\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}",
3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791
                expectsWarningGlyph: true);

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";
3792
            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);
3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845
            VerifyWithReferenceWorker(markup, new[] { expectedDescription });
        }

        [WorkItem(962353)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";

3846
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.LocalVariable}) int x"), Usage("") });
3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874
        }

        [WorkItem(1020944)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";

3875
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.LocalVariable}) int x"), Usage("\r\n    Proj1 - Available\r\n    Proj2 - Not Available\r\n\r\nYou can use the navigation bar to switch context.", expectsWarningGlyph: true) });
3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899
        }

        [WorkItem(1020944)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";

3900
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.Label}) LABEL"), Usage("") });
3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925
        }

        [WorkItem(1020944)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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>";

3926
            VerifyWithReferenceWorker(markup, new[] { MainDescription($"({FeaturesResources.RangeVariable}) int y"), Usage("") });
3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980
        }

        [WorkItem(1019766)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        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)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void AwaitingTaskOfArrayType()
        {
            var markup = @"
using System.Threading.Tasks;

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

        [WorkItem(1114300)]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public void AwaitingTaskOfDynamic()
        {
            var markup = @"
using System.Threading.Tasks;

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