SemanticQuickInfoSourceTests.cs 139.1 KB
Newer Older
1
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
2 3 4 5 6

using System;
using System.Linq;
using System.Security;
using System.Threading;
C
Cyrus Najmabadi 已提交
7
using System.Threading.Tasks;
8
using System.Xml.Linq;
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Projection;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QuickInfo
{
    public class SemanticQuickInfoSourceTests : AbstractSemanticQuickInfoSourceTests
    {
C
Cyrus Najmabadi 已提交
25
        private async Task TestWithOptionsAsync(CSharpParseOptions options, string markup, params Action<object>[] expectedResults)
26
        {
C
Cyrus Najmabadi 已提交
27
            using (var workspace = await TestWorkspace.CreateCSharpAsync(markup, options))
28
            {
29
                await TestWithOptionsAsync(workspace, expectedResults);
30 31
            }
        }
32

33
        private async Task TestWithOptionsAsync(TestWorkspace workspace, params Action<object>[] expectedResults)
34 35 36 37 38
        {
            var testDocument = workspace.DocumentWithCursor;
            var position = testDocument.CursorPosition.GetValueOrDefault();
            var documentId = workspace.GetDocumentId(testDocument);
            var document = workspace.CurrentSolution.GetDocument(documentId);
39

40 41 42 43 44 45
            var provider = new SemanticQuickInfoProvider(
                workspace.GetService<IProjectionBufferFactoryService>(),
                workspace.GetService<IEditorOptionsFactoryService>(),
                workspace.GetService<ITextEditorFactoryService>(),
                workspace.GetService<IGlyphService>(),
                workspace.GetService<ClassificationTypeMap>());
46

47
            await TestWithOptionsAsync(document, provider, position, expectedResults);
48 49

            // speculative semantic model
50
            if (await CanUseSpeculativeSemanticModelAsync(document, position))
51 52 53 54 55 56 57
            {
                var buffer = testDocument.TextBuffer;
                using (var edit = buffer.CreateEdit())
                {
                    var currentSnapshot = buffer.CurrentSnapshot;
                    edit.Replace(0, currentSnapshot.Length, currentSnapshot.GetText());
                    edit.Apply();
58
                }
59

60
                await TestWithOptionsAsync(document, provider, position, expectedResults);
61 62 63
            }
        }

64
        private async Task TestWithOptionsAsync(Document document, SemanticQuickInfoProvider provider, int position, Action<object>[] expectedResults)
65
        {
C
Cyrus Najmabadi 已提交
66
            var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
            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);
                }
            }
        }

C
Cyrus Najmabadi 已提交
87
        private async Task VerifyWithMscorlib45Async(string markup, Action<object>[] expectedResults)
88 89 90 91 92 93 94 95 96 97
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""C#"" CommonReferencesNet45=""true"">
        <Document FilePath=""SourceDocument"">
{0}
        </Document>
    </Project>
</Workspace>", SecurityElement.Escape(markup));

C
Cyrus Najmabadi 已提交
98
            using (var workspace = await TestWorkspace.CreateAsync(xmlString))
99 100 101 102 103 104 105 106 107 108 109 110
            {
                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<IProjectionBufferFactoryService>(),
                        workspace.GetService<IEditorOptionsFactoryService>(),
                        workspace.GetService<ITextEditorFactoryService>(),
                        workspace.GetService<IGlyphService>(),
                        workspace.GetService<ClassificationTypeMap>());

C
Cyrus Najmabadi 已提交
111
                var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
                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);
                    }
                }
            }
        }

C
Cyrus Najmabadi 已提交
133
        protected override async Task TestAsync(string markup, params Action<object>[] expectedResults)
134
        {
C
Cyrus Najmabadi 已提交
135 136
            await TestWithOptionsAsync(Options.Regular, markup, expectedResults);
            await TestWithOptionsAsync(Options.Script, markup, expectedResults);
137 138
        }

C
Cyrus Najmabadi 已提交
139
        protected async Task TestWithUsingsAsync(string markup, params Action<object>[] expectedResults)
140 141 142 143 144 145 146
        {
            var markupWithUsings =
@"using System;
using System.Collections.Generic;
using System.Linq;
" + markup;

C
Cyrus Najmabadi 已提交
147
            await TestAsync(markupWithUsings, expectedResults);
148 149
        }

C
Cyrus Najmabadi 已提交
150
        protected Task TestInClassAsync(string markup, params Action<object>[] expectedResults)
151 152
        {
            var markupInClass = "class C { " + markup + " }";
C
Cyrus Najmabadi 已提交
153
            return TestWithUsingsAsync(markupInClass, expectedResults);
154 155
        }

C
Cyrus Najmabadi 已提交
156
        protected Task TestInMethodAsync(string markup, params Action<object>[] expectedResults)
157 158
        {
            var markupInMethod = "class C { void M() { " + markup + " } }";
C
Cyrus Najmabadi 已提交
159
            return TestWithUsingsAsync(markupInMethod, expectedResults);
160 161
        }

C
Cyrus Najmabadi 已提交
162
        private async Task TestWithReferenceAsync(string sourceCode,
163 164 165 166 167
            string referencedCode,
            string sourceLanguage,
            string referencedLanguage,
            params Action<object>[] expectedResults)
        {
C
Cyrus Najmabadi 已提交
168 169
            await TestWithMetadataReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults);
            await TestWithProjectReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults);
170 171 172 173

            // Multi-language projects are not supported.
            if (sourceLanguage == referencedLanguage)
            {
C
Cyrus Najmabadi 已提交
174
                await TestInSameProjectHelperAsync(sourceCode, referencedCode, sourceLanguage, expectedResults);
175 176 177
            }
        }

C
Cyrus Najmabadi 已提交
178
        private async Task TestWithMetadataReferenceHelperAsync(
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
            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));

C
Cyrus Najmabadi 已提交
200
            await VerifyWithReferenceWorkerAsync(xmlString, expectedResults);
201 202
        }

C
Cyrus Najmabadi 已提交
203
        private async Task TestWithProjectReferenceHelperAsync(
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
            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));

C
Cyrus Najmabadi 已提交
227
            await VerifyWithReferenceWorkerAsync(xmlString, expectedResults);
228 229
        }

C
Cyrus Najmabadi 已提交
230
        private async Task TestInSameProjectHelperAsync(
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
            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));

C
Cyrus Najmabadi 已提交
248
            await VerifyWithReferenceWorkerAsync(xmlString, expectedResults);
249 250
        }

C
Cyrus Najmabadi 已提交
251
        private async Task VerifyWithReferenceWorkerAsync(string xmlString, params Action<object>[] expectedResults)
252
        {
C
Cyrus Najmabadi 已提交
253
            using (var workspace = await TestWorkspace.CreateAsync(xmlString))
254 255 256 257 258 259 260 261 262 263 264 265
            {
                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<IProjectionBufferFactoryService>(),
                        workspace.GetService<IEditorOptionsFactoryService>(),
                        workspace.GetService<ITextEditorFactoryService>(),
                        workspace.GetService<IGlyphService>(),
                        workspace.GetService<ClassificationTypeMap>());

C
Cyrus Najmabadi 已提交
266
                var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
                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);
                    }
                }
            }
        }

C
Cyrus Najmabadi 已提交
288
        protected async Task TestInvalidTypeInClassAsync(string code)
289 290
        {
            var codeInClass = "class C { " + code + " }";
C
Cyrus Najmabadi 已提交
291
            await TestAsync(codeInClass);
292 293
        }

294
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
295
        public async Task TestNamespaceInUsingDirective()
296
        {
C
CyrusNajmabadi 已提交
297 298
            await TestAsync(
@"using $$System;",
299 300 301
                MainDescription("namespace System"));
        }

302
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
303
        public async Task TestNamespaceInUsingDirective2()
304
        {
C
CyrusNajmabadi 已提交
305 306
            await TestAsync(
@"using System.Coll$$ections.Generic;",
307 308 309
                MainDescription("namespace System.Collections"));
        }

310
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
311
        public async Task TestNamespaceInUsingDirective3()
312
        {
C
CyrusNajmabadi 已提交
313 314
            await TestAsync(
@"using System.L$$inq;",
315 316 317
                MainDescription("namespace System.Linq"));
        }

318
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
319
        public async Task TestNamespaceInUsingDirectiveWithAlias()
320
        {
C
CyrusNajmabadi 已提交
321 322
            await TestAsync(
@"using Foo = Sys$$tem.Console;",
323 324 325
                MainDescription("namespace System"));
        }

326
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
327
        public async Task TestTypeInUsingDirectiveWithAlias()
328
        {
C
CyrusNajmabadi 已提交
329 330
            await TestAsync(
@"using Foo = System.Con$$sole;",
331 332 333
                MainDescription("class System.Console"));
        }

J
Jared Parsons 已提交
334
        [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")]
335
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
336
        public async Task TestDocumentationInUsingDirectiveWithAlias()
337 338 339 340 341 342
        {
            var markup =
@"using I$$ = IFoo;
///<summary>summary for interface IFoo</summary>
interface IFoo {  }";

C
Cyrus Najmabadi 已提交
343
            await TestAsync(markup,
344 345 346 347
                MainDescription("interface IFoo"),
                Documentation("summary for interface IFoo"));
        }

J
Jared Parsons 已提交
348
        [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")]
349
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
350
        public async Task TestDocumentationInUsingDirectiveWithAlias2()
351 352 353 354 355 356 357
        {
            var markup =
@"using I = IFoo;
///<summary>summary for interface IFoo</summary>
interface IFoo {  }
class C : I$$ { }";

C
Cyrus Najmabadi 已提交
358
            await TestAsync(markup,
359 360 361 362
                MainDescription("interface IFoo"),
                Documentation("summary for interface IFoo"));
        }

J
Jared Parsons 已提交
363
        [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")]
364
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
365
        public async Task TestDocumentationInUsingDirectiveWithAlias3()
366 367 368 369 370 371 372 373 374 375
        {
            var markup =
@"using I = IFoo;
///<summary>summary for interface IFoo</summary>
interface IFoo 
{  
    void Foo();
}
class C : I$$ { }";

C
Cyrus Najmabadi 已提交
376
            await TestAsync(markup,
377 378 379 380
                MainDescription("interface IFoo"),
                Documentation("summary for interface IFoo"));
        }

381
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
382
        public async Task TestThis()
383 384 385 386 387 388
        {
            var markup =
@"
///<summary>summary for Class C</summary>
class C { string M() {  return thi$$s.ToString(); } }";

C
Cyrus Najmabadi 已提交
389
            await TestWithUsingsAsync(markup,
390 391 392 393
                MainDescription("class C"),
                Documentation("summary for Class C"));
        }

394
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
395
        public async Task TestClassWithDocComment()
396 397 398 399 400 401
        {
            var markup =
@"
///<summary>Hello!</summary>
class C { void M() { $$C obj; } }";

C
Cyrus Najmabadi 已提交
402
            await TestAsync(markup,
403 404 405 406
                MainDescription("class C"),
                Documentation("Hello!"));
        }

407
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
408
        public async Task TestSingleLineDocComments()
409 410 411 412
        {
            // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedSingleLineComment

            // SingleLine doc comment with leading whitespace
C
CyrusNajmabadi 已提交
413 414 415 416 417 418 419 420 421
            await TestAsync(
@"///<summary>Hello!</summary>
class C
{
    void M()
    {
        $$C obj;
    }
}",
422 423 424 425
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with space before opening tag
C
CyrusNajmabadi 已提交
426 427 428 429 430 431 432 433 434
            await TestAsync(
@"/// <summary>Hello!</summary>
class C
{
    void M()
    {
        $$C obj;
    }
}",
435 436 437 438
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with space before opening tag and leading whitespace
C
CyrusNajmabadi 已提交
439 440 441 442 443 444 445 446 447
            await TestAsync(
@"/// <summary>Hello!</summary>
class C
{
    void M()
    {
        $$C obj;
    }
}",
448 449 450 451
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with leading whitespace and blank line
C
CyrusNajmabadi 已提交
452 453 454
            await TestAsync(
@"///<summary>Hello!
///</summary>
455

C
CyrusNajmabadi 已提交
456 457 458 459 460 461 462
class C
{
    void M()
    {
        $$C obj;
    }
}",
463 464 465 466
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with '\r' line separators
C
Cyrus Najmabadi 已提交
467
            await TestAsync("///<summary>Hello!\r///</summary>\rclass C { void M() { $$C obj; } }",
468 469 470 471
                MainDescription("class C"),
                Documentation("Hello!"));
        }

472
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
473
        public async Task TestMultiLineDocComments()
474 475 476 477
        {
            // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedMultiLineComment

            // Multiline doc comment with leading whitespace
C
CyrusNajmabadi 已提交
478 479 480 481 482 483 484 485 486
            await TestAsync(
@"/**<summary>Hello!</summary>*/
class C
{
    void M()
    {
        $$C obj;
    }
}",
487 488 489 490
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with space before opening tag
C
CyrusNajmabadi 已提交
491 492
            await TestAsync(
@"/** <summary>Hello!</summary>
493
 **/
C
CyrusNajmabadi 已提交
494 495 496 497 498 499 500
class C
{
    void M()
    {
        $$C obj;
    }
}",
501 502 503 504
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with space before opening tag and leading whitespace
C
CyrusNajmabadi 已提交
505 506 507 508 509 510 511 512 513 514 515
            await TestAsync(
@"/**
 ** <summary>Hello!</summary>
 **/
class C
{
    void M()
    {
        $$C obj;
    }
}",
516 517 518 519
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with no per-line prefix
C
CyrusNajmabadi 已提交
520 521
            await TestAsync(
@"/**
522 523 524 525
  <summary>
  Hello!
  </summary>
*/
C
CyrusNajmabadi 已提交
526 527 528 529 530 531 532
class C
{
    void M()
    {
        $$C obj;
    }
}",
533 534 535 536
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with inconsistent per-line prefix
C
CyrusNajmabadi 已提交
537 538
            await TestAsync(
@"/**
539 540 541 542
 ** <summary>
    Hello!</summary>
 **
 **/
C
CyrusNajmabadi 已提交
543 544 545 546 547 548 549
class C
{
    void M()
    {
        $$C obj;
    }
}",
550 551 552 553
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with closing comment on final line
C
CyrusNajmabadi 已提交
554 555
            await TestAsync(
@"/**
556 557
<summary>Hello!
</summary>*/
C
CyrusNajmabadi 已提交
558 559 560 561 562 563 564
class C
{
    void M()
    {
        $$C obj;
    }
}",
565 566 567 568
                MainDescription("class C"),
                Documentation("Hello!"));

            // Multiline doc comment with '\r' line separators
C
Cyrus Najmabadi 已提交
569
            await TestAsync("/**\r* <summary>\r* Hello!\r* </summary>\r*/\rclass C { void M() { $$C obj; } }",
570 571 572 573
                MainDescription("class C"),
                Documentation("Hello!"));
        }

574
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
575
        public async Task TestMethodWithDocComment()
576 577 578 579 580 581
        {
            var markup =
@"
///<summary>Hello!</summary>
void M() { M$$() }";

C
Cyrus Najmabadi 已提交
582
            await TestInClassAsync(markup,
583 584 585 586
                MainDescription("void C.M()"),
                Documentation("Hello!"));
        }

587
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
588
        public async Task TestInt32()
589
        {
590 591
            await TestInClassAsync(
@"$$Int32 i;",
592 593 594
                MainDescription("struct System.Int32"));
        }

595
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
596
        public async Task TestBuiltInInt()
597
        {
598 599
            await TestInClassAsync(
@"$$int i;",
600 601 602
                MainDescription("struct System.Int32"));
        }

603
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
604
        public async Task TestString()
605
        {
606 607
            await TestInClassAsync(
@"$$String s;",
608 609 610
                MainDescription("class System.String"));
        }

611
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
612
        public async Task TestBuiltInString()
613
        {
614 615
            await TestInClassAsync(
@"$$string s;",
616 617 618
                MainDescription("class System.String"));
        }

619
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
620
        public async Task TestBuiltInStringAtEndOfToken()
621
        {
622 623
            await TestInClassAsync(
@"string$$ s;",
624 625 626
                MainDescription("class System.String"));
        }

627
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
628
        public async Task TestBoolean()
629
        {
630 631
            await TestInClassAsync(
@"$$Boolean b;",
632 633 634
                MainDescription("struct System.Boolean"));
        }

635
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
636
        public async Task TestBuiltInBool()
637
        {
638 639
            await TestInClassAsync(
@"$$bool b;",
640 641 642
                MainDescription("struct System.Boolean"));
        }

643
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
644
        public async Task TestSingle()
645
        {
646 647
            await TestInClassAsync(
@"$$Single s;",
648 649 650
                MainDescription("struct System.Single"));
        }

651
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
652
        public async Task TestBuiltInFloat()
653
        {
654 655
            await TestInClassAsync(
@"$$float f;",
656 657 658
                MainDescription("struct System.Single"));
        }

659
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
660
        public async Task TestVoidIsInvalid()
661
        {
662 663 664 665
            await TestInvalidTypeInClassAsync(
@"$$void M()
{
}");
666 667
        }

668
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
669
        public async Task TestInvalidPointer1_931958()
670
        {
671 672
            await TestInvalidTypeInClassAsync(
@"$$T* i;");
673 674
        }

675
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
676
        public async Task TestInvalidPointer2_931958()
677
        {
678 679
            await TestInvalidTypeInClassAsync(
@"T$$* i;");
680 681
        }

682
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
683
        public async Task TestInvalidPointer3_931958()
684
        {
685 686
            await TestInvalidTypeInClassAsync(
@"T*$$ i;");
687 688
        }

689
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
690
        public async Task TestListOfString()
691
        {
692 693
            await TestInClassAsync(
@"$$List<string> l;",
694
                MainDescription("class System.Collections.Generic.List<T>"),
695
                TypeParameterMap($"\r\nT {FeaturesResources.is_} string"));
696 697
        }

698
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
699
        public async Task TestListOfSomethingFromSource()
700 701 702 703 704 705
        {
            var markup =
@"
///<summary>Generic List</summary>
public class GenericList<T> { Generic$$List<int> t; }";

C
Cyrus Najmabadi 已提交
706
            await TestAsync(markup,
707 708
                MainDescription("class GenericList<T>"),
                Documentation("Generic List"),
709
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
710 711
        }

712
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
713
        public async Task TestListOfT()
714
        {
715 716 717 718 719
            await TestInMethodAsync(
@"class C<T>
{
    $$List<T> l;
}",
720 721 722
                MainDescription("class System.Collections.Generic.List<T>"));
        }

723
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
724
        public async Task TestDictionaryOfIntAndString()
725
        {
726 727
            await TestInClassAsync(
@"$$Dictionary<int, string> d;",
728 729
                MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"),
                TypeParameterMap(
730 731
                    Lines($"\r\nTKey {FeaturesResources.is_} int",
                          $"TValue {FeaturesResources.is_} string")));
732 733
        }

734
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
735
        public async Task TestDictionaryOfTAndU()
736
        {
737 738 739 740 741
            await TestInMethodAsync(
@"class C<T, U>
{
    $$Dictionary<T, U> d;
}",
742 743
                MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"),
                TypeParameterMap(
744 745
                    Lines($"\r\nTKey {FeaturesResources.is_} T",
                          $"TValue {FeaturesResources.is_} U")));
746 747
        }

748
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
749
        public async Task TestIEnumerableOfInt()
750
        {
751 752 753 754 755
            await TestInClassAsync(
@"$$IEnumerable<int> M()
{
    yield break;
}",
756
                MainDescription("interface System.Collections.Generic.IEnumerable<out T>"),
757
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
758 759
        }

760
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
761
        public async Task TestEventHandler()
762
        {
763 764
            await TestInClassAsync(
@"event $$EventHandler e;",
765 766 767
                MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)"));
        }

768
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
769
        public async Task TestTypeParameter()
770
        {
C
CyrusNajmabadi 已提交
771 772 773 774 775
            await TestAsync(
@"class C<T>
{
    $$T t;
}",
776
                MainDescription($"T {FeaturesResources.in_} C<T>"));
777 778
        }

J
Jared Parsons 已提交
779
        [WorkItem(538636, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538636")]
780
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
781
        public async Task TestTypeParameterWithDocComment()
782 783 784 785 786 787 788
        {
            var markup =
@"
///<summary>Hello!</summary>
///<typeparam name=""T"">T is Type Parameter</typeparam>
class C<T> { $$T t; }";

C
Cyrus Najmabadi 已提交
789
            await TestAsync(markup,
790
                MainDescription($"T {FeaturesResources.in_} C<T>"),
791 792 793
                Documentation("T is Type Parameter"));
        }

794
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
795
        public async Task TestTypeParameter1_Bug931949()
796
        {
C
CyrusNajmabadi 已提交
797 798 799 800 801
            await TestAsync(
@"class T1<T11>
{
    $$T11 t;
}",
802
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
803 804
        }

805
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
806
        public async Task TestTypeParameter2_Bug931949()
807
        {
C
CyrusNajmabadi 已提交
808 809 810 811 812
            await TestAsync(
@"class T1<T11>
{
    T$$11 t;
}",
813
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
814 815
        }

816
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
817
        public async Task TestTypeParameter3_Bug931949()
818
        {
C
CyrusNajmabadi 已提交
819 820 821 822 823
            await TestAsync(
@"class T1<T11>
{
    T1$$1 t;
}",
824
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
825 826
        }

827
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
828
        public async Task TestTypeParameter4_Bug931949()
829
        {
C
CyrusNajmabadi 已提交
830 831 832 833 834
            await TestAsync(
@"class T1<T11>
{
    T11$$ t;
}",
835
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
836 837
        }

838
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
839
        public async Task TestNullableOfInt()
840
        {
C
Cyrus Najmabadi 已提交
841
            await TestInClassAsync(@"$$Nullable<int> i; }",
842
                MainDescription("struct System.Nullable<T> where T : struct"),
843
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
844 845
        }

846
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
847
        public async Task TestGenericTypeDeclaredOnMethod1_Bug1946()
848
        {
C
CyrusNajmabadi 已提交
849 850 851 852 853 854 855 856
            await TestAsync(
@"class C
{
    static void Meth1<T1>($$T1 i) where T1 : struct
    {
        T1 i;
    }
}",
857
                MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct"));
858 859
        }

860
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
861
        public async Task TestGenericTypeDeclaredOnMethod2_Bug1946()
862
        {
C
CyrusNajmabadi 已提交
863 864 865 866 867 868 869 870
            await TestAsync(
@"class C
{
    static void Meth1<T1>(T1 i) where $$T1 : struct
    {
        T1 i;
    }
}",
871
                MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct"));
872 873
        }

874
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
875
        public async Task TestGenericTypeDeclaredOnMethod3_Bug1946()
876
        {
C
CyrusNajmabadi 已提交
877 878 879 880 881 882 883 884
            await TestAsync(
@"class C
{
    static void Meth1<T1>(T1 i) where T1 : struct
    {
        $$T1 i;
    }
}",
885
                MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct"));
886 887
        }

888
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
889
        public async Task TestGenericTypeParameterConstraint_Class()
890
        {
C
CyrusNajmabadi 已提交
891 892 893 894
            await TestAsync(
@"class C<T> where $$T : class
{
}",
895
                MainDescription($"T {FeaturesResources.in_} C<T> where T : class"));
896 897
        }

898
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
899
        public async Task TestGenericTypeParameterConstraint_Struct()
900
        {
C
CyrusNajmabadi 已提交
901 902 903 904
            await TestAsync(
@"struct S<T> where $$T : class
{
}",
905
                MainDescription($"T {FeaturesResources.in_} S<T> where T : class"));
906 907
        }

908
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
909
        public async Task TestGenericTypeParameterConstraint_Interface()
910
        {
C
CyrusNajmabadi 已提交
911 912 913 914
            await TestAsync(
@"interface I<T> where $$T : class
{
}",
915
                MainDescription($"T {FeaturesResources.in_} I<T> where T : class"));
916 917
        }

918
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
919
        public async Task TestGenericTypeParameterConstraint_Delegate()
920
        {
C
CyrusNajmabadi 已提交
921 922
            await TestAsync(
@"delegate void D<T>() where $$T : class;",
923
                MainDescription($"T {FeaturesResources.in_} D<T> where T : class"));
924 925
        }

926
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
927
        public async Task TestMinimallyQualifiedConstraint()
928
        {
C
Cyrus Najmabadi 已提交
929
            await TestAsync(@"class C<T> where $$T : IEnumerable<int>",
930
                MainDescription($"T {FeaturesResources.in_} C<T> where T : IEnumerable<int>"));
931 932
        }

933
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
934
        public async Task FullyQualifiedConstraint()
935
        {
C
Cyrus Najmabadi 已提交
936
            await TestAsync(@"class C<T> where $$T : System.Collections.Generic.IEnumerable<int>",
937
                MainDescription($"T {FeaturesResources.in_} C<T> where T : System.Collections.Generic.IEnumerable<int>"));
938 939
        }

940
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
941
        public async Task TestMethodReferenceInSameMethod()
942
        {
C
CyrusNajmabadi 已提交
943 944 945 946 947 948 949 950
            await TestAsync(
@"class C
{
    void M()
    {
        M$$();
    }
}",
951 952 953
                MainDescription("void C.M()"));
        }

954
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
955
        public async Task TestMethodReferenceInSameMethodWithDocComment()
956 957 958 959 960 961
        {
            var markup =
@"
///<summary>Hello World</summary>
void M() { M$$(); }";

C
Cyrus Najmabadi 已提交
962
            await TestInClassAsync(markup,
963 964 965 966
                MainDescription("void C.M()"),
                Documentation("Hello World"));
        }

967
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
968
        public async Task TestFieldInMethodBuiltIn()
969 970 971 972 973 974 975 976 977
        {
            var markup =
@"int field;

void M()
{
    field$$
}";

C
Cyrus Najmabadi 已提交
978
            await TestInClassAsync(markup,
979
                MainDescription($"({FeaturesResources.field}) int C.field"));
980 981
        }

982
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
983
        public async Task TestFieldInMethodBuiltIn2()
984
        {
985 986 987 988 989 990 991
            await TestInClassAsync(
@"int field;

void M()
{
    int f = field$$;
}",
992
                MainDescription($"({FeaturesResources.field}) int C.field"));
993 994
        }

995
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
996
        public async Task TestFieldInMethodBuiltInWithFieldInitializer()
997
        {
998 999 1000 1001 1002
            await TestInClassAsync(
@"int field = 1;

void M()
{
C
CyrusNajmabadi 已提交
1003
    int f = field $$;
1004
}");
1005 1006
        }

1007
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1008
        public async Task TestOperatorBuiltIn()
1009
        {
1010 1011 1012 1013
            await TestInMethodAsync(
@"int x;

x = x$$+1;",
1014 1015 1016
                MainDescription("int int.operator +(int left, int right)"));
        }

1017
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1018
        public async Task TestOperatorBuiltIn1()
1019
        {
1020 1021 1022 1023
            await TestInMethodAsync(
@"int x;

x = x$$ + 1;",
1024
                MainDescription($"({FeaturesResources.local_variable}) int x"));
1025 1026
        }

1027
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1028
        public async Task TestOperatorBuiltIn2()
1029
        {
1030 1031 1032 1033
            await TestInMethodAsync(
@"int x;

x = x+$$x;",
1034
                MainDescription($"({FeaturesResources.local_variable}) int x"));
1035 1036
        }

1037
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1038
        public async Task TestOperatorBuiltIn3()
1039
        {
1040 1041 1042 1043
            await TestInMethodAsync(
@"int x;

x = x +$$ x;",
1044 1045 1046
                MainDescription("int int.operator +(int left, int right)"));
        }

1047
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1048
        public async Task TestOperatorBuiltIn4()
1049
        {
1050 1051 1052 1053
            await TestInMethodAsync(
@"int x;

x = x + $$x;",
1054
                MainDescription($"({FeaturesResources.local_variable}) int x"));
1055 1056
        }

1057
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1058
        public async Task TestOperatorCustomTypeBuiltIn()
1059 1060 1061 1062 1063 1064 1065
        {
            var markup =
@"class C
{
    static void M() { C c; c = c +$$ c; }
}";

C
Cyrus Najmabadi 已提交
1066
            await TestAsync(markup);
1067 1068
        }

1069
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1070
        public async Task TestOperatorCustomTypeOverload()
1071 1072 1073 1074 1075 1076 1077 1078
        {
            var markup =
@"class C
{
    static void M() { C c; c = c +$$ c; }
    static C operator+(C a, C b) { return a; }
}";

C
Cyrus Najmabadi 已提交
1079
            await TestAsync(markup,
1080 1081 1082
                MainDescription("C C.operator +(C a, C b)"));
        }

1083
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1084
        public async Task TestFieldInMethodMinimal()
1085 1086 1087 1088 1089 1090 1091 1092 1093
        {
            var markup =
@"DateTime field;

void M()
{
    field$$
}";

C
Cyrus Najmabadi 已提交
1094
            await TestInClassAsync(markup,
1095
                MainDescription($"({FeaturesResources.field}) DateTime C.field"));
1096 1097
        }

1098
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1099
        public async Task TestFieldInMethodQualified()
1100 1101 1102 1103 1104 1105 1106 1107 1108
        {
            var markup =
@"System.IO.FileInfo file;

void M()
{
    file$$
}";

C
Cyrus Najmabadi 已提交
1109
            await TestInClassAsync(markup,
1110
                MainDescription($"({FeaturesResources.field}) System.IO.FileInfo C.file"));
1111 1112
        }

1113
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1114
        public async Task TestMemberOfStructFromSource()
1115 1116 1117 1118 1119 1120
        {
            var markup =
@"struct MyStruct {
public static int SomeField; }
static class Test { int a = MyStruct.Some$$Field; }";

C
Cyrus Najmabadi 已提交
1121
            await TestAsync(markup,
1122
                MainDescription($"({FeaturesResources.field}) int MyStruct.SomeField"));
1123 1124
        }

J
Jared Parsons 已提交
1125
        [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")]
1126
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1127
        public async Task TestMemberOfStructFromSourceWithDocComment()
1128 1129 1130 1131 1132 1133 1134
        {
            var markup =
@"struct MyStruct {
///<summary>My Field</summary>
public static int SomeField; }
static class Test { int a = MyStruct.Some$$Field; }";

C
Cyrus Najmabadi 已提交
1135
            await TestAsync(markup,
1136
                MainDescription($"({FeaturesResources.field}) int MyStruct.SomeField"),
1137 1138 1139
                Documentation("My Field"));
        }

1140
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1141
        public async Task TestMemberOfStructInsideMethodFromSource()
1142 1143 1144 1145 1146 1147
        {
            var markup =
@"struct MyStruct {
public static int SomeField; }
static class Test { static void Method() { int a = MyStruct.Some$$Field; } }";

C
Cyrus Najmabadi 已提交
1148
            await TestAsync(markup,
1149
                MainDescription($"({FeaturesResources.field}) int MyStruct.SomeField"));
1150 1151
        }

J
Jared Parsons 已提交
1152
        [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")]
1153
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1154
        public async Task TestMemberOfStructInsideMethodFromSourceWithDocComment()
1155 1156 1157 1158 1159 1160 1161
        {
            var markup =
@"struct MyStruct {
///<summary>My Field</summary>
public static int SomeField; }
static class Test { static void Method() { int a = MyStruct.Some$$Field; } }";

C
Cyrus Najmabadi 已提交
1162
            await TestAsync(markup,
1163
                MainDescription($"({FeaturesResources.field}) int MyStruct.SomeField"),
1164 1165 1166
                Documentation("My Field"));
        }

1167
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1168
        public async Task TestMetadataFieldMinimal()
1169
        {
C
Cyrus Najmabadi 已提交
1170
            await TestInMethodAsync(@"DateTime dt = DateTime.MaxValue$$",
1171
                MainDescription($"({FeaturesResources.field}) DateTime DateTime.MaxValue"));
1172 1173
        }

1174
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1175
        public async Task TestMetadataFieldQualified1()
1176 1177 1178 1179 1180 1181 1182 1183 1184
        {
            // 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$$
    }
}";
C
Cyrus Najmabadi 已提交
1185
            await TestAsync(markup,
1186
                MainDescription($"({FeaturesResources.field}) System.DateTime System.DateTime.MaxValue"));
1187 1188
        }

1189
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1190
        public async Task TestMetadataFieldQualified2()
1191
        {
C
CyrusNajmabadi 已提交
1192 1193 1194
            await TestAsync(
@"class C
{
1195 1196 1197 1198 1199
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}",
1200
                MainDescription($"({FeaturesResources.field}) System.DateTime System.DateTime.MaxValue"));
1201 1202
        }

1203
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1204
        public async Task TestMetadataFieldQualified3()
1205
        {
C
CyrusNajmabadi 已提交
1206 1207 1208 1209 1210
            await TestAsync(
@"using System;

class C
{
1211 1212 1213 1214 1215
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}",
1216
                MainDescription($"({FeaturesResources.field}) DateTime DateTime.MaxValue"));
1217 1218
        }

1219
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1220
        public async Task ConstructedGenericField()
1221
        {
C
CyrusNajmabadi 已提交
1222 1223 1224 1225 1226
            await TestAsync(
@"class C<T>
{
    public T Field;
}
1227

C
CyrusNajmabadi 已提交
1228 1229 1230 1231
class D
{
    void M()
    {
1232 1233 1234
        new C<int>().Fi$$eld.ToString();
    }
}",
1235
                MainDescription($"({FeaturesResources.field}) int C<int>.Field"));
1236 1237
        }

1238
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1239
        public async Task UnconstructedGenericField()
1240
        {
C
CyrusNajmabadi 已提交
1241 1242 1243
            await TestAsync(
@"class C<T>
{
1244 1245
    public T Field;

C
CyrusNajmabadi 已提交
1246 1247
    void M()
    {
1248 1249 1250
        Fi$$eld.ToString();
    }
}",
1251
                MainDescription($"({FeaturesResources.field}) T C<T>.Field"));
1252 1253
        }

1254
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1255
        public async Task TestIntegerLiteral()
1256
        {
C
Cyrus Najmabadi 已提交
1257
            await TestInMethodAsync(@"int f = 37$$",
1258 1259 1260
                MainDescription("struct System.Int32"));
        }

1261
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1262
        public async Task TestTrueKeyword()
1263
        {
C
Cyrus Najmabadi 已提交
1264
            await TestInMethodAsync(@"bool f = true$$",
1265 1266 1267
                MainDescription("struct System.Boolean"));
        }

1268
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1269
        public async Task TestFalseKeyword()
1270
        {
C
Cyrus Najmabadi 已提交
1271
            await TestInMethodAsync(@"bool f = false$$",
1272 1273 1274
                MainDescription("struct System.Boolean"));
        }

J
Jared Parsons 已提交
1275
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")]
1276
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1277
        public async Task TestAwaitKeywordOnGenericTaskReturningAsync()
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public async Task<int> Calc()
    {
        aw$$ait Calc();
        return 5;
    }
}";
1288
            await TestAsync(markup, MainDescription($"{FeaturesResources.Awaited_task_returns} struct System.Int32"));
1289 1290
        }

J
Jared Parsons 已提交
1291
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")]
1292
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1293
        public async Task TestAwaitKeywordInDeclarationStatement()
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public async Task<int> Calc()
    {
        var x = $$await Calc();
        return 5;
    }
}";
1304
            await TestAsync(markup, MainDescription($"{FeaturesResources.Awaited_task_returns} struct System.Int32"));
1305 1306
        }

J
Jared Parsons 已提交
1307
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")]
1308
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1309
        public async Task TestAwaitKeywordOnTaskReturningAsync()
1310 1311 1312 1313 1314 1315 1316 1317 1318
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public async void Calc()
    {
        aw$$ait Task.Delay(100);
    }
}";
1319
            await TestAsync(markup, MainDescription($"{FeaturesResources.Awaited_task_returns} {FeaturesResources.no_value}"));
1320 1321
        }

J
Jared Parsons 已提交
1322
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1323
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1324
        public async Task TestNestedAwaitKeywords1()
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
        {
            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();
    }
}";
1354 1355
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) {FeaturesResources.Awaited_task_returns} class System.Threading.Tasks.Task<TResult>"),
                         TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int"));
1356 1357
        }

J
Jared Parsons 已提交
1358
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")]
1359
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1360
        public async Task TestNestedAwaitKeywords2()
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389
        {
            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();
    }
}";
1390
            await TestAsync(markup, MainDescription($"{FeaturesResources.Awaited_task_returns} struct System.Int32"));
1391 1392
        }

J
Jared Parsons 已提交
1393
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1394
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1395
        public async Task TestAwaitablePrefixOnCustomAwaiter()
1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416
        {
            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() { }
}";
1417
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class C"));
1418 1419
        }

J
Jared Parsons 已提交
1420
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1421
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1422
        public async Task TestTaskType()
1423 1424 1425 1426 1427 1428 1429 1430 1431
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public void Calc()
    {
        Task$$ v1;
    }
}";
1432
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task"));
1433 1434
        }

J
Jared Parsons 已提交
1435
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1436
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1437
        public async Task TestTaskOfTType()
1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
        {
            var markup = @"using System;
using System.Threading.Tasks;
class C
{
    public void Calc()
    {
        Task$$<int> v1;
    }
}";
1448 1449
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task<TResult>"),
                         TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int"));
1450 1451
        }

1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468
        [WorkItem(7100, "https://github.com/dotnet/roslyn/issues/7100")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestDynamicIsntAwaitable()
        {
            var markup = @"
class C
{
    dynamic D() { return null; }
    void M()
    {
        D$$();
    }
}
";
            await TestAsync(markup, MainDescription("dynamic C.D()"));
        }

1469
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1470
        public async Task TestStringLiteral()
1471
        {
C
Cyrus Najmabadi 已提交
1472
            await TestInMethodAsync(@"string f = ""Foo""$$",
1473 1474 1475
                MainDescription("class System.String"));
        }

1476
        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1477
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1478
        public async Task TestVerbatimStringLiteral()
1479
        {
C
Cyrus Najmabadi 已提交
1480
            await TestInMethodAsync(@"string f = @""cat""$$",
1481 1482 1483 1484
                MainDescription("class System.String"));
        }

        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1485
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1486
        public async Task TestInterpolatedStringLiteral()
1487
        {
C
Cyrus Najmabadi 已提交
1488 1489 1490 1491
            await TestInMethodAsync(@"string f = $""cat""$$", MainDescription("class System.String"));
            await TestInMethodAsync(@"string f = $""c$$at""", MainDescription("class System.String"));
            await TestInMethodAsync(@"string f = $""$$cat""", MainDescription("class System.String"));
            await TestInMethodAsync(@"string f = $""cat {1$$ + 2} dog""", MainDescription("struct System.Int32"));
1492 1493 1494
        }

        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1495
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1496
        public async Task TestVerbatimInterpolatedStringLiteral()
1497
        {
C
Cyrus Najmabadi 已提交
1498 1499 1500 1501
            await TestInMethodAsync(@"string f = $@""cat""$$", MainDescription("class System.String"));
            await TestInMethodAsync(@"string f = $@""c$$at""", MainDescription("class System.String"));
            await TestInMethodAsync(@"string f = $@""$$cat""", MainDescription("class System.String"));
            await TestInMethodAsync(@"string f = $@""cat {1$$ + 2} dog""", MainDescription("struct System.Int32"));
1502 1503
        }

1504
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1505
        public async Task TestCharLiteral()
1506
        {
C
Cyrus Najmabadi 已提交
1507
            await TestInMethodAsync(@"string f = 'x'$$",
1508 1509 1510
                MainDescription("struct System.Char"));
        }

1511
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1512
        public async Task DynamicKeyword()
1513
        {
1514 1515
            await TestInMethodAsync(
@"dyn$$amic dyn;",
1516
                MainDescription("dynamic"),
1517
                Documentation(FeaturesResources.Represents_an_object_whose_operations_will_be_resolved_at_runtime));
1518 1519
        }

1520
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1521
        public async Task DynamicField()
1522
        {
1523 1524 1525
            await TestInClassAsync(
@"dynamic dyn;

1526 1527 1528 1529
void M()
{
    d$$yn.Foo();
}",
1530
                MainDescription($"({FeaturesResources.field}) dynamic C.dyn"));
1531 1532
        }

1533
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1534
        public async Task LocalProperty_Minimal()
1535
        {
1536 1537 1538
            await TestInClassAsync(
@"DateTime Prop { get; set; }

1539 1540 1541 1542 1543 1544 1545
void M()
{
    P$$rop.ToString();
}",
                MainDescription("DateTime C.Prop { get; set; }"));
        }

1546
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1547
        public async Task LocalProperty_Minimal_PrivateSet()
1548
        {
1549 1550 1551
            await TestInClassAsync(
@"public DateTime Prop { get; private set; }

1552 1553 1554 1555 1556 1557 1558
void M()
{
    P$$rop.ToString();
}",
                MainDescription("DateTime C.Prop { get; private set; }"));
        }

1559
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1560
        public async Task LocalProperty_Minimal_PrivateSet1()
1561
        {
1562 1563 1564
            await TestInClassAsync(
@"protected internal int Prop { get; private set; }

1565 1566 1567 1568 1569 1570 1571
void M()
{
    P$$rop.ToString();
}",
                MainDescription("int C.Prop { get; private set; }"));
        }

1572
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1573
        public async Task LocalProperty_Qualified()
1574
        {
1575 1576 1577
            await TestInClassAsync(
@"System.IO.FileInfo Prop { get; set; }

1578 1579 1580 1581 1582 1583 1584
void M()
{
    P$$rop.ToString();
}",
                MainDescription("System.IO.FileInfo C.Prop { get; set; }"));
        }

1585
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1586
        public async Task NonLocalProperty_Minimal()
1587
        {
C
Cyrus Najmabadi 已提交
1588
            await TestInMethodAsync(@"DateTime.No$$w.ToString();",
1589 1590 1591
                MainDescription("DateTime DateTime.Now { get; }"));
        }

1592
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1593
        public async Task NonLocalProperty_Qualified()
1594
        {
1595 1596 1597 1598
            await TestInMethodAsync(
@"System.IO.FileInfo f;

f.Att$$ributes.ToString();",
1599 1600 1601
                MainDescription("System.IO.FileAttributes System.IO.FileSystemInfo.Attributes { get; set; }"));
        }

1602
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1603
        public async Task ConstructedGenericProperty()
1604
        {
C
CyrusNajmabadi 已提交
1605 1606 1607 1608
            await TestAsync(
@"class C<T>
{
    public T Property { get; set }
1609 1610
}

C
CyrusNajmabadi 已提交
1611 1612 1613 1614
class D
{
    void M()
    {
1615 1616 1617 1618 1619 1620
        new C<int>().Pro$$perty.ToString();
    }
}",
                MainDescription("int C<int>.Property { get; set; }"));
        }

1621
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1622
        public async Task UnconstructedGenericProperty()
1623
        {
C
CyrusNajmabadi 已提交
1624 1625 1626
            await TestAsync(
@"class C<T>
{
1627 1628
    public T Property { get; set}

C
CyrusNajmabadi 已提交
1629 1630
    void M()
    {
1631 1632 1633 1634 1635 1636
        Pro$$perty.ToString();
    }
}",
                MainDescription("T C<T>.Property { get; set; }"));
        }

1637
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1638
        public async Task ValueInProperty()
1639
        {
1640 1641 1642 1643 1644 1645 1646 1647
            await TestInClassAsync(
@"public DateTime Property
{
    set
    {
        foo = val$$ue;
    }
}",
1648
                MainDescription($"({FeaturesResources.parameter}) DateTime value"));
1649 1650
        }

1651
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1652
        public async Task EnumTypeName()
1653
        {
C
Cyrus Najmabadi 已提交
1654
            await TestInMethodAsync(@"Consol$$eColor c",
1655 1656 1657
                MainDescription("enum System.ConsoleColor"));
        }

1658
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1659
        public async Task EnumMemberNameFromMetadata()
1660
        {
C
Cyrus Najmabadi 已提交
1661
            await TestInMethodAsync(@"ConsoleColor c = ConsoleColor.Bla$$ck",
1662 1663 1664
                MainDescription("ConsoleColor.Black = 0"));
        }

1665
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1666
        public async Task FlagsEnumMemberNameFromMetadata1()
1667
        {
C
Cyrus Najmabadi 已提交
1668
            await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.Cl$$ass",
1669 1670 1671
                MainDescription("AttributeTargets.Class = 4"));
        }

1672
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1673
        public async Task FlagsEnumMemberNameFromMetadata2()
1674
        {
C
Cyrus Najmabadi 已提交
1675
            await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.A$$ll",
1676 1677 1678
                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"));
        }

1679
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1680
        public async Task EnumMemberNameFromSource1()
1681
        {
C
CyrusNajmabadi 已提交
1682 1683
            await TestAsync(
@"enum E
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699
{
    A = 1 << 0,
    B = 1 << 1,
    C = 1 << 2
}

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

1700
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1701
        public async Task EnumMemberNameFromSource2()
1702
        {
C
CyrusNajmabadi 已提交
1703 1704
            await TestAsync(
@"enum E
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720
{
    A,
    B,
    C
}

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

1721
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1722
        public async Task Parameter_InMethod_Minimal()
1723
        {
1724 1725 1726 1727
            await TestInClassAsync(
@"void M(DateTime dt)
{
    d$$t.ToString();",
1728
                MainDescription($"({FeaturesResources.parameter}) DateTime dt"));
1729 1730
        }

1731
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1732
        public async Task Parameter_InMethod_Qualified()
1733
        {
1734 1735 1736 1737
            await TestInClassAsync(
@"void M(System.IO.FileInfo fileInfo)
{
    file$$Info.ToString();",
1738
                MainDescription($"({FeaturesResources.parameter}) System.IO.FileInfo fileInfo"));
1739 1740
        }

1741
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1742
        public async Task Parameter_FromReferenceToNamedParameter()
1743
        {
C
Cyrus Najmabadi 已提交
1744
            await TestInMethodAsync(@"Console.WriteLine(va$$lue: ""Hi"");",
1745
                MainDescription($"({FeaturesResources.parameter}) string value"));
1746 1747
        }

1748
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1749
        public async Task Parameter_DefaultValue()
1750 1751 1752
        {
            // NOTE: Dev10 doesn't show the default value, but it would be nice if we did.
            // NOTE: The "DefaultValue" property isn't implemented yet.
1753 1754 1755 1756 1757
            await TestInClassAsync(
@"void M(int param = 42)
{
    para$$m.ToString();
}",
1758
                MainDescription($"({FeaturesResources.parameter}) int param = 42"));
1759 1760
        }

1761
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1762
        public async Task Parameter_Params()
1763
        {
1764 1765 1766 1767 1768
            await TestInClassAsync(
@"void M(params DateTime[] arg)
{
    ar$$g.ToString();
}",
1769
                MainDescription($"({FeaturesResources.parameter}) params DateTime[] arg"));
1770 1771
        }

1772
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1773
        public async Task Parameter_Ref()
1774
        {
1775 1776 1777 1778 1779
            await TestInClassAsync(
@"void M(ref DateTime arg)
{
    ar$$g.ToString();
}",
1780
                MainDescription($"({FeaturesResources.parameter}) ref DateTime arg"));
1781 1782
        }

1783
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1784
        public async Task Parameter_Out()
1785
        {
1786 1787 1788 1789 1790
            await TestInClassAsync(
@"void M(out DateTime arg)
{
    ar$$g.ToString();
}",
1791
                MainDescription($"({FeaturesResources.parameter}) out DateTime arg"));
1792 1793
        }

1794
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1795
        public async Task Local_Minimal()
1796
        {
1797 1798 1799 1800
            await TestInMethodAsync(
@"DateTime dt;

d$$t.ToString();",
1801
                MainDescription($"({FeaturesResources.local_variable}) DateTime dt"));
1802 1803
        }

1804
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1805
        public async Task Local_Qualified()
1806
        {
1807 1808 1809 1810
            await TestInMethodAsync(
@"System.IO.FileInfo fileInfo;

file$$Info.ToString();",
1811
                MainDescription($"({FeaturesResources.local_variable}) System.IO.FileInfo fileInfo"));
1812 1813
        }

1814
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1815
        public async Task Method_MetadataOverload()
1816
        {
C
Cyrus Najmabadi 已提交
1817
            await TestInMethodAsync("Console.Write$$Line();",
1818
                MainDescription($"void Console.WriteLine() (+ 18 {FeaturesResources.overloads_})"));
1819 1820
        }

1821
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1822
        public async Task Method_SimpleWithOverload()
1823
        {
1824 1825 1826 1827 1828 1829 1830 1831 1832
            await TestInClassAsync(
@"void Method()
{
    Met$$hod();
}

void Method(int i)
{
}",
1833
                MainDescription($"void C.Method() (+ 1 {FeaturesResources.overload})"));
1834 1835
        }

1836
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1837
        public async Task Method_MoreOverloads()
1838
        {
1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855
            await TestInClassAsync(
@"void Method()
{
    Met$$hod(null);
}

void Method(int i)
{
}

void Method(DateTime dt)
{
}

void Method(System.IO.FileInfo fileInfo)
{
}",
1856
                MainDescription($"void C.Method(System.IO.FileInfo fileInfo) (+ 3 {FeaturesResources.overloads_})"));
1857 1858
        }

1859
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1860
        public async Task Method_SimpleInSameClass()
1861
        {
1862 1863 1864 1865 1866
            await TestInClassAsync(
@"DateTime GetDate(System.IO.FileInfo ft)
{
    Get$$Date(null);
}",
1867 1868 1869
                MainDescription("DateTime C.GetDate(System.IO.FileInfo ft)"));
        }

1870
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1871
        public async Task Method_OptionalParameter()
1872
        {
1873 1874 1875 1876 1877 1878 1879 1880 1881
            await TestInClassAsync(
@"void M()
{
    Met$$hod();
}

void Method(int i = 0)
{
}",
1882 1883 1884
                MainDescription("void C.Method([int i = 0])"));
        }

1885
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1886
        public async Task Method_OptionalDecimalParameter()
1887
        {
1888 1889 1890 1891
            await TestInClassAsync(
@"void Foo(decimal x$$yz = 10)
{
}",
1892
                MainDescription($"({FeaturesResources.parameter}) decimal xyz = 10"));
1893 1894
        }

1895
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1896
        public async Task Method_Generic()
1897 1898 1899
        {
            // Generic method don't get the instantiation info yet.  NOTE: We don't display
            // constraint info in Dev10. Should we?
1900 1901 1902
            await TestInClassAsync(
@"TOut Foo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>
{
1903 1904 1905 1906 1907 1908
    Fo$$o<int, DateTime>(37);
}",

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

1909
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1910
        public async Task Method_UnconstructedGeneric()
1911
        {
1912 1913 1914
            await TestInClassAsync(
@"TOut Foo<TIn, TOut>(TIn arg)
{
1915 1916 1917 1918 1919 1920
    Fo$$o<TIn, TOut>(default(TIn);
}",

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

1921
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1922
        public async Task Method_Inferred()
1923
        {
1924 1925 1926
            await TestInClassAsync(
@"void Foo<TIn>(TIn arg)
{
1927 1928 1929 1930 1931
    Fo$$o(42);
}",
                MainDescription("void C.Foo<int>(int arg)"));
        }

1932
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1933
        public async Task Method_MultipleParams()
1934
        {
1935 1936 1937
            await TestInClassAsync(
@"void Foo(DateTime dt, System.IO.FileInfo fi, int number)
{
1938 1939 1940 1941 1942
    Fo$$o(DateTime.Now, null, 32);
}",
                MainDescription("void C.Foo(DateTime dt, System.IO.FileInfo fi, int number)"));
        }

1943
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1944
        public async Task Method_OptionalParam()
1945 1946
        {
            // NOTE - Default values aren't actually returned by symbols yet.
1947 1948 1949
            await TestInClassAsync(
@"void Foo(int num = 42)
{
1950 1951 1952 1953 1954
    Fo$$o();
}",
                MainDescription("void C.Foo([int num = 42])"));
        }

1955
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1956
        public async Task Method_ParameterModifiers()
1957 1958
        {
            // NOTE - Default values aren't actually returned by symbols yet.
1959 1960 1961
            await TestInClassAsync(
@"void Foo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers)
{
1962 1963 1964 1965 1966
    Fo$$o(DateTime.Now, null, 32);
}",
                MainDescription("void C.Foo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers)"));
        }

1967
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1968
        public async Task Constructor()
1969
        {
1970 1971 1972 1973 1974 1975 1976 1977 1978
            await TestInClassAsync(
@"public C()
{
}

void M()
{
    new C$$().ToString();
}",
1979 1980 1981
                MainDescription("C.C()"));
        }

1982
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1983
        public async Task Constructor_Overloads()
1984
        {
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996
            await TestInClassAsync(
@"public C()
{
}

public C(DateTime dt)
{
}

public C(int i)
{
}
1997 1998 1999

void M()
{
2000
    new C$$(DateTime.MaxValue).ToString();
2001
}",
2002
                MainDescription($"C.C(DateTime dt) (+ 2 {FeaturesResources.overloads_})"));
2003 2004 2005 2006 2007
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
2008
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2009
        public async Task Constructor_OverloadFromStringLiteral()
2010
        {
2011 2012
            await TestInMethodAsync(
@"new InvalidOperatio$$nException("""");",
2013
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})"));
2014 2015 2016 2017 2018
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
2019
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2020
        public async Task Constructor_UnknownType()
2021
        {
2022 2023 2024 2025 2026
            await TestInvalidTypeInClassAsync(
@"void M()
{
    new F$$oo();
}");
2027 2028 2029 2030 2031
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
2032
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2033
        public async Task Constructor_OverloadFromProperty()
2034
        {
2035 2036
            await TestInMethodAsync(
@"new InvalidOperatio$$nException(this.GetType().Name);",
2037
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})"));
2038 2039
        }

2040
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2041
        public async Task Constructor_Metadata()
2042
        {
2043 2044
            await TestInMethodAsync(
@"new Argument$$NullException();",
2045
                MainDescription($"ArgumentNullException.ArgumentNullException() (+ 3 {FeaturesResources.overloads_})"));
2046 2047
        }

2048
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2049
        public async Task Constructor_MetadataQualified()
2050
        {
C
Cyrus Najmabadi 已提交
2051
            await TestInMethodAsync(@"new System.IO.File$$Info(null);",
2052 2053 2054
                MainDescription("System.IO.FileInfo.FileInfo(string fileName)"));
        }

2055
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2056
        public async Task InterfaceProperty()
2057
        {
2058 2059
            await TestInMethodAsync(
@"interface I
2060 2061 2062 2063 2064 2065
{
    string Name$$ { get; set; }
}",
                MainDescription("string I.Name { get; set; }"));
        }

2066
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2067
        public async Task ExplicitInterfacePropertyImplementation()
2068
        {
2069 2070
            await TestInMethodAsync(
@"interface I
2071 2072 2073 2074 2075 2076 2077 2078
{
    string Name { get; set; }
}

class C : I
{
    string IEmployee.Name$$
    {
2079 2080 2081 2082 2083 2084 2085 2086
        get
        {
            return """";
        }

        set
        {
        }
2087 2088 2089 2090 2091
    }
}",
                MainDescription("string C.Name { get; set; }"));
        }

2092
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2093
        public async Task Operator()
2094
        {
2095 2096 2097 2098 2099 2100 2101 2102 2103 2104
            await TestInClassAsync(
@"public static C operator +(C left, C right)
{
    return null;
}

void M(C left, C right)
{
    return left +$$ right;
}",
2105 2106 2107 2108
                MainDescription("C C.operator +(C left, C right)"));
        }

        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
2109
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2110
        public async Task GenericMethodWithConstraintsAtDeclaration()
2111
        {
2112 2113 2114
            await TestInClassAsync(
@"TOut F$$oo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>
{
2115 2116 2117 2118 2119 2120
}",

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

        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
2121
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2122
        public async Task GenericMethodWithMultipleConstraintsAtDeclaration()
2123
        {
2124 2125
            await TestInClassAsync(
@"TOut Foo<TIn, TOut>(TIn arg) where TIn : Employee, new()
2126 2127
{
    Fo$$o<TIn, TOut>(default(TIn);
2128
}",
2129 2130 2131 2132 2133

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

        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
2134
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2135
        public async Task UnConstructedGenericMethodWithConstraintsAtInvocation()
2136
        {
2137 2138
            await TestInClassAsync(
@"TOut Foo<TIn, TOut>(TIn arg) where TIn : Employee
2139 2140
{
    Fo$$o<TIn, TOut>(default(TIn);
2141
}",
2142 2143 2144 2145

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

2146
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2147
        public async Task GenericTypeWithConstraintsAtDeclaration()
2148
        {
C
CyrusNajmabadi 已提交
2149 2150
            await TestAsync(
@"public class Employee : IComparable<Employee>
2151 2152 2153 2154 2155 2156
{
    public int CompareTo(Employee other)
    {
        throw new NotImplementedException();
    }
}
C
CyrusNajmabadi 已提交
2157

2158 2159 2160 2161 2162 2163 2164
class Emplo$$yeeList<T> : IEnumerable<T> where T : Employee, System.IComparable<T>, new()
{
}",

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

2165
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2166
        public async Task GenericType()
2167
        {
C
CyrusNajmabadi 已提交
2168 2169
            await TestAsync(
@"class T1<T11>
2170 2171
{
    $$T11 i;
C
CyrusNajmabadi 已提交
2172
}",
2173
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
2174 2175
        }

2176
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2177
        public async Task GenericMethod()
2178
        {
2179 2180 2181 2182 2183
            await TestInClassAsync(
@"static void Meth1<T1>(T1 i) where T1 : struct
{
    $$T1 i;
}",
2184
                MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct"));
2185 2186
        }

2187
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2188
        public async Task Var()
2189
        {
2190 2191 2192
            await TestInMethodAsync(
@"var x = new Exception();
var y = $$x;",
2193
                MainDescription($"({FeaturesResources.local_variable}) Exception x"));
2194 2195
        }

2196
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2197
        public async Task NestedInGeneric()
2198
        {
2199 2200
            await TestInMethodAsync(
@"List<int>.Enu$$merator e;",
2201
                MainDescription("struct System.Collections.Generic.List<T>.Enumerator"),
2202
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
2203 2204
        }

2205
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2206
        public async Task NestedGenericInGeneric()
2207
        {
C
CyrusNajmabadi 已提交
2208 2209
            await TestAsync(
@"class Outer<T>
2210 2211 2212 2213 2214 2215 2216 2217 2218
{
    class Inner<U>
    {
    }

    static void M()
    {
        Outer<int>.I$$nner<string> e;
    }
C
CyrusNajmabadi 已提交
2219
}",
2220 2221
                MainDescription("class Outer<T>.Inner<U>"),
                TypeParameterMap(
2222 2223
                    Lines($"\r\nT {FeaturesResources.is_} int",
                          $"U {FeaturesResources.is_} string")));
2224 2225
        }

2226
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2227
        public async Task ObjectInitializer1()
2228
        {
2229 2230 2231 2232 2233
            await TestInClassAsync(
@"void M()
{
    var x = new test() { $$z = 5 };
}
2234

2235 2236 2237 2238
class test
{
    public int z;
}",
2239
                MainDescription($"({FeaturesResources.field}) int test.z"));
2240 2241
        }

2242
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2243
        public async Task ObjectInitializer2()
2244
        {
2245 2246
            await TestInMethodAsync(
@"class C
2247 2248 2249 2250 2251 2252 2253 2254 2255 2256
{
    void M()
    {
        var x = new test() { z = $$5 };
    }

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

2261
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
2262
        [WorkItem(537880, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537880")]
C
Cyrus Najmabadi 已提交
2263
        public async Task TypeArgument()
2264
        {
C
CyrusNajmabadi 已提交
2265 2266
            await TestAsync(
@"class C<T, Y>
2267 2268 2269 2270 2271 2272 2273
{
    void M()
    {
        C<int, DateTime> variable;
        $$variable = new C<int, DateTime>();
    }
}",
2274
                MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable"));
2275 2276
        }

2277
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2278
        public async Task ForEachLoop_1()
2279
        {
2280 2281 2282
            await TestInMethodAsync(
@"int bb = 555;

2283 2284 2285 2286
bb = bb + 1;
foreach (int cc in new int[]{ 1,2,3}){
c$$c = 1;
bb = bb + 21;
2287
}",
2288
                MainDescription($"({FeaturesResources.local_variable}) int cc"));
2289 2290
        }

2291
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2292
        public async Task TryCatchFinally_1()
2293
        {
2294 2295
            await TestInMethodAsync(
@"try
2296 2297
            {
                int aa = 555;
2298 2299

a$$a = aa + 1;
2300 2301 2302 2303 2304 2305 2306
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }",
2307
                MainDescription($"({FeaturesResources.local_variable}) int aa"));
2308 2309
        }

2310
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2311
        public async Task TryCatchFinally_2()
2312
        {
2313 2314
            await TestInMethodAsync(
@"try
2315 2316 2317 2318 2319
            {
            }
            catch (Exception ex)
            {
                var y = e$$x;
2320
var z = y;
2321 2322 2323
            }
            finally
            {
2324
            }",
2325
                MainDescription($"({FeaturesResources.local_variable}) Exception ex"));
2326 2327
        }

2328
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2329
        public async Task TryCatchFinally_3()
2330
        {
2331 2332
            await TestInMethodAsync(
@"try
2333 2334 2335 2336 2337
            {
            }
            catch (Exception ex)
            {
                var aa = 555;
2338 2339

aa = a$$a + 1;
2340 2341 2342
            }
            finally
            {
2343
            }",
2344
                MainDescription($"({FeaturesResources.local_variable}) int aa"));
2345 2346
        }

2347
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2348
        public async Task TryCatchFinally_4()
2349
        {
2350 2351
            await TestInMethodAsync(
@"try
2352 2353 2354 2355 2356 2357 2358 2359
            {
            }
            catch (Exception ex)
            {
            }
            finally
            {
                int aa = 555;
2360 2361 2362

aa = a$$a + 1;
            }",
2363
                MainDescription($"({FeaturesResources.local_variable}) int aa"));
2364 2365
        }

2366
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2367
        public async Task GenericVariable()
2368
        {
C
CyrusNajmabadi 已提交
2369 2370 2371 2372 2373 2374 2375 2376 2377
            await TestAsync(
@"class C<T, Y>
{
    void M()
    {
        C<int, DateTime> variable;
        var$$iable = new C<int, DateTime>();
    }
}",
2378
                MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable"));
2379 2380
        }

2381
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2382
        public async Task TestInstantiation()
2383
        {
C
CyrusNajmabadi 已提交
2384 2385 2386
            await TestAsync(
@"using System.Collections.Generic;

2387 2388 2389 2390 2391 2392 2393
class Program<T>
{
    static void Main(string[] args)
    {
        var p = new Dictio$$nary<int, string>();
    }
}",
2394
                MainDescription($"Dictionary<int, string>.Dictionary() (+ 5 {FeaturesResources.overloads_})"));
2395 2396
        }

2397
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2398
        public async Task TestUsingAlias_Bug4141()
2399
        {
C
CyrusNajmabadi 已提交
2400 2401 2402 2403 2404 2405 2406 2407
            await TestAsync(
@"using X = A.C;

class A
{
    public class C
    {
    }
2408
}
C
CyrusNajmabadi 已提交
2409 2410 2411 2412

class D : X$$
{
}",
2413 2414 2415
                MainDescription(@"class A.C"));
        }

2416
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2417
        public async Task TestFieldOnDeclaration()
2418
        {
2419 2420
            await TestInClassAsync(
@"DateTime fie$$ld;",
2421
                MainDescription($"({FeaturesResources.field}) DateTime C.field"));
2422 2423
        }

J
Jared Parsons 已提交
2424
        [WorkItem(538767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538767")]
2425
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2426
        public async Task TestGenericErrorFieldOnDeclaration()
2427
        {
2428 2429
            await TestInClassAsync(
@"NonExistentType<int> fi$$eld;",
2430
                MainDescription($"({FeaturesResources.field}) NonExistentType<int> C.field"));
2431 2432
        }

J
Jared Parsons 已提交
2433
        [WorkItem(538822, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538822")]
2434
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2435
        public async Task TestDelegateType()
2436
        {
2437 2438
            await TestInClassAsync(
@"Fun$$c<int, string> field;",
2439 2440
                MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"),
                TypeParameterMap(
2441 2442
                    Lines($"\r\nT {FeaturesResources.is_} int",
                          $"TResult {FeaturesResources.is_} string")));
2443 2444
        }

J
Jared Parsons 已提交
2445
        [WorkItem(538824, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538824")]
2446
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2447
        public async Task TestOnDelegateInvocation()
2448
        {
C
CyrusNajmabadi 已提交
2449 2450
            await TestAsync(
@"class Program
2451 2452
{
    delegate void D1();
C
CyrusNajmabadi 已提交
2453

2454 2455 2456
    static void Main()
    {
        D1 d = Main;
C
CyrusNajmabadi 已提交
2457
        $$d();
2458
    }
C
CyrusNajmabadi 已提交
2459
}",
2460
                MainDescription($"({FeaturesResources.local_variable}) D1 d"));
2461 2462
        }

J
Jared Parsons 已提交
2463
        [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")]
2464
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2465
        public async Task TestOnArrayCreation1()
2466
        {
C
CyrusNajmabadi 已提交
2467 2468
            await TestAsync(
@"class Program
2469 2470 2471 2472 2473
{
    static void Main()
    {
        int[] a = n$$ew int[0];
    }
2474
}", MainDescription("int[]"));
2475 2476
        }

J
Jared Parsons 已提交
2477
        [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")]
2478
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2479
        public async Task TestOnArrayCreation2()
2480
        {
C
CyrusNajmabadi 已提交
2481 2482
            await TestAsync(
@"class Program
2483 2484 2485 2486 2487 2488 2489 2490 2491
{
    static void Main()
    {
        int[] a = new i$$nt[0];
    }
}",
                MainDescription("struct System.Int32"));
        }

J
Jared Parsons 已提交
2492
        [WorkItem(539841, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539841")]
2493
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2494
        public async Task TestIsNamedTypeAccessibleForErrorTypes()
2495
        {
C
CyrusNajmabadi 已提交
2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506
            await TestAsync(
@"sealed class B<T1, T2> : A<B<T1, T2>>
{
    protected sealed override B<A<T>, A$$<T>> N()
    {
    }
}

internal class A<T>
{
}",
2507 2508 2509
                MainDescription("class A<T>"));
        }

J
Jared Parsons 已提交
2510
        [WorkItem(540075, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540075")]
2511
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2512
        public async Task TestErrorType()
2513
        {
C
CyrusNajmabadi 已提交
2514 2515 2516
            await TestAsync(
@"using Foo = Foo;

2517 2518 2519 2520 2521 2522 2523 2524 2525 2526
class C
{
    void Main()
    {
        $$Foo
    }
}",
                MainDescription("Foo"));
        }

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 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 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 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619
        [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestShortDiscardInAssignment()
        {
            await TestAsync(
@"class C
{
    int M()
    {
        $$_ = M();
    }
}",
                MainDescription("int _"));
        }

        [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestUnderscoreLocalInAssignment()
        {
            await TestAsync(
@"class C
{
    int M()
    {
        var $$_ = M();
    }
}",
                MainDescription($"({FeaturesResources.local_variable}) int _"));
        }

        [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestShortDiscardInOutVar()
        {
            await TestAsync(
@"class C
{
    void M(out int i)
    {
        M(out $$_);
        i = 0;
    }
}",
                MainDescription($"int _"));
        }

        [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestDiscardInOutVar()
        {
            await TestAsync(
@"class C
{
    void M(out int i)
    {
        M(out var $$_);
        i = 0;
    }
}"); // No quick info (see issue #16667)
        }

        [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestDiscardInIsPattern()
        {
            await TestAsync(
@"class C
{
    void M()
    {
        if (3 is int $$_) { }
    }
}"); // No quick info (see issue #16667)
        }

        [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestDiscardInSwitchPattern()
        {
            await TestAsync(
@"class C
{
    void M()
    {
        switch (3)
        {
            case int $$_:
                return;
        }
    }
}"); // No quick info (see issue #16667)
        }

J
Jared Parsons 已提交
2620
        [WorkItem(540871, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540871")]
2621
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2622
        public async Task TestLiterals()
2623
        {
C
CyrusNajmabadi 已提交
2624 2625
            await TestAsync(
@"class MyClass
2626
{
C
CyrusNajmabadi 已提交
2627
    MyClass() : this($$10)
2628 2629 2630
    {
        intI = 2;
    }
C
CyrusNajmabadi 已提交
2631 2632 2633 2634 2635

    public MyClass(int i)
    {
    }

2636
    static int intI = 1;
C
CyrusNajmabadi 已提交
2637

2638 2639 2640 2641 2642 2643 2644 2645
    public static int Main()
    {
        return 1;
    }
}",
                MainDescription("struct System.Int32"));
        }

J
Jared Parsons 已提交
2646
        [WorkItem(541444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541444")]
2647
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2648
        public async Task TestErrorInForeach()
2649
        {
C
CyrusNajmabadi 已提交
2650 2651
            await TestAsync(
@"class C
2652 2653 2654 2655 2656 2657 2658 2659 2660
{
    void Main()
    {
        foreach (int cc in null)
        {
            $$cc = 1;
        }
    }
}",
2661
                MainDescription($"({FeaturesResources.local_variable}) int cc"));
2662 2663
        }

J
Jared Parsons 已提交
2664
        [WorkItem(540438, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540438")]
2665
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2666
        public async Task TestNoQuickInfoOnAnonymousDelegate()
2667
        {
C
CyrusNajmabadi 已提交
2668 2669
            await TestAsync(
@"using System;
2670 2671 2672 2673 2674

class Program
{
    static void Main(string[] args)
    {
2675
        Action a = $$delegate {
C
CyrusNajmabadi 已提交
2676
        };
2677 2678 2679 2680
    }
}");
        }

J
Jared Parsons 已提交
2681
        [WorkItem(541678, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541678")]
2682
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2683
        public async Task TestQuickInfoOnEvent()
2684
        {
C
CyrusNajmabadi 已提交
2685 2686 2687
            await TestAsync(
@"using System;

2688 2689
public class SampleEventArgs
{
C
CyrusNajmabadi 已提交
2690 2691 2692 2693 2694 2695
    public SampleEventArgs(string s)
    {
        Text = s;
    }

    public String Text { get; private set; }
2696
}
C
CyrusNajmabadi 已提交
2697

2698 2699 2700
public class Publisher
{
    public delegate void SampleEventHandler(object sender, SampleEventArgs e);
C
CyrusNajmabadi 已提交
2701

2702
    public event SampleEventHandler SampleEvent;
C
CyrusNajmabadi 已提交
2703

2704 2705 2706 2707 2708
    protected virtual void RaiseSampleEvent()
    {
        if (Sam$$pleEvent != null)
            SampleEvent(this, new SampleEventArgs(""Hello""));
    }
C
CyrusNajmabadi 已提交
2709
}",
2710 2711 2712
                MainDescription("SampleEventHandler Publisher.SampleEvent"));
        }

J
Jared Parsons 已提交
2713
        [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")]
2714
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2715
        public async Task TestEvent()
2716
        {
C
Cyrus Najmabadi 已提交
2717
            await TestInMethodAsync(@"System.Console.CancelKeyPres$$s += null;",
2718 2719 2720
                MainDescription("ConsoleCancelEventHandler Console.CancelKeyPress"));
        }

J
Jared Parsons 已提交
2721
        [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")]
2722
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2723
        public async Task TestEventPlusEqualsOperator()
2724
        {
C
Cyrus Najmabadi 已提交
2725
            await TestInMethodAsync(@"System.Console.CancelKeyPress +$$= null;",
2726 2727 2728
                MainDescription("void Console.CancelKeyPress.add"));
        }

J
Jared Parsons 已提交
2729
        [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")]
2730
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2731
        public async Task TestEventMinusEqualsOperator()
2732
        {
C
Cyrus Najmabadi 已提交
2733
            await TestInMethodAsync(@"System.Console.CancelKeyPress -$$= null;",
2734 2735 2736
                MainDescription("void Console.CancelKeyPress.remove"));
        }

J
Jared Parsons 已提交
2737
        [WorkItem(541885, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541885")]
2738
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2739
        public async Task TestQuickInfoOnExtensionMethod()
2740
        {
2741 2742
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2743 2744
using System.Collections.Generic;
using System.Linq;
2745

2746 2747 2748 2749
class Program
{
    static void Main(string[] args)
    {
2750 2751 2752
        int[] values = {
            1
        };
2753 2754 2755
        bool isArray = 7.I$$n(values);
    }
}
2756

2757 2758 2759 2760 2761 2762
public static class MyExtensions
{
    public static bool In<T>(this T o, IEnumerable<T> items)
    {
        return true;
    }
2763
}",
2764
                MainDescription($"({CSharpFeaturesResources.extension}) bool int.In<int>(IEnumerable<int> items)"));
2765 2766
        }

2767
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2768
        public async Task TestQuickInfoOnExtensionMethodOverloads()
2769
        {
2770 2771
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2772 2773 2774 2775 2776 2777
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
2778
        ""1"".Test$$Ext();
2779 2780
    }
}
2781

2782 2783
public static class Ex
{
2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795
    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)
    {
    }
}",
2796
                MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 2 {FeaturesResources.overloads_})"));
2797 2798
        }

2799
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2800
        public async Task TestQuickInfoOnExtensionMethodOverloads2()
2801
        {
2802 2803
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2804 2805 2806 2807 2808 2809
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
2810
        ""1"".Test$$Ext();
2811 2812
    }
}
2813

2814 2815
public static class Ex
{
2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827
    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)
    {
    }
}",
2828
                MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 1 {FeaturesResources.overload})"));
2829 2830
        }

2831
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2832
        public async Task Query1()
2833
        {
C
CyrusNajmabadi 已提交
2834 2835 2836
            await TestAsync(
@"using System.Linq;

2837 2838 2839 2840
class C
{
    void M()
    {
C
CyrusNajmabadi 已提交
2841 2842
        var q = from n in new int[] { 1, 2, 3, 4, 5 }

2843 2844
                select $$n;
    }
C
CyrusNajmabadi 已提交
2845
}",
2846
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2847 2848
        }

2849
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2850
        public async Task Query2()
2851
        {
C
CyrusNajmabadi 已提交
2852 2853 2854
            await TestAsync(
@"using System.Linq;

2855 2856 2857 2858
class C
{
    void M()
    {
C
CyrusNajmabadi 已提交
2859 2860
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5 }

2861 2862
                select n;
    }
C
CyrusNajmabadi 已提交
2863
}",
2864
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2865 2866
        }

2867
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2868
        public async Task Query3()
2869
        {
C
CyrusNajmabadi 已提交
2870 2871
            await TestAsync(
@"class C
2872 2873 2874
{
    void M()
    {
C
CyrusNajmabadi 已提交
2875 2876
        var q = from n in new int[] { 1, 2, 3, 4, 5 }

2877 2878
                select $$n;
    }
C
CyrusNajmabadi 已提交
2879
}",
2880
                MainDescription($"({FeaturesResources.range_variable}) ? n"));
2881 2882
        }

2883
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2884
        public async Task Query4()
2885
        {
C
CyrusNajmabadi 已提交
2886 2887
            await TestAsync(
@"class C
2888 2889 2890
{
    void M()
    {
C
CyrusNajmabadi 已提交
2891 2892
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5 }

2893 2894
                select n;
    }
C
CyrusNajmabadi 已提交
2895
}",
2896
                MainDescription($"({FeaturesResources.range_variable}) ? n"));
2897 2898
        }

2899
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2900
        public async Task Query5()
2901
        {
C
CyrusNajmabadi 已提交
2902 2903
            await TestAsync(
@"using System.Collections.Generic;
2904
using System.Linq;
C
CyrusNajmabadi 已提交
2905

2906 2907 2908 2909 2910 2911 2912
class C
{
    void M()
    {
        var q = from n in new List<object>()
                select $$n;
    }
C
CyrusNajmabadi 已提交
2913
}",
2914
                MainDescription($"({FeaturesResources.range_variable}) object n"));
2915 2916
        }

2917
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2918
        public async Task Query6()
2919
        {
C
CyrusNajmabadi 已提交
2920 2921
            await TestAsync(
@"using System.Collections.Generic;
2922
using System.Linq;
C
CyrusNajmabadi 已提交
2923

2924 2925 2926 2927 2928 2929 2930
class C
{
    void M()
    {
        var q = from n$$ in new List<object>()
                select n;
    }
C
CyrusNajmabadi 已提交
2931
}",
2932
                MainDescription($"({FeaturesResources.range_variable}) object n"));
2933 2934
        }

2935
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2936
        public async Task Query7()
2937
        {
C
CyrusNajmabadi 已提交
2938 2939
            await TestAsync(
@"using System.Collections.Generic;
2940
using System.Linq;
C
CyrusNajmabadi 已提交
2941

2942 2943 2944 2945 2946 2947 2948
class C
{
    void M()
    {
        var q = from int n in new List<object>()
                select $$n;
    }
C
CyrusNajmabadi 已提交
2949
}",
2950
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2951 2952
        }

2953
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2954
        public async Task Query8()
2955
        {
C
CyrusNajmabadi 已提交
2956 2957
            await TestAsync(
@"using System.Collections.Generic;
2958
using System.Linq;
C
CyrusNajmabadi 已提交
2959

2960 2961 2962 2963 2964 2965 2966
class C
{
    void M()
    {
        var q = from int n$$ in new List<object>()
                select n;
    }
C
CyrusNajmabadi 已提交
2967
}",
2968
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2969 2970
        }

2971
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2972
        public async Task Query9()
2973
        {
C
CyrusNajmabadi 已提交
2974 2975
            await TestAsync(
@"using System.Collections.Generic;
2976
using System.Linq;
C
CyrusNajmabadi 已提交
2977

2978 2979 2980 2981 2982 2983 2984 2985
class C
{
    void M()
    {
        var q = from x$$ in new List<List<int>>()
                from y in x
                select y;
    }
C
CyrusNajmabadi 已提交
2986
}",
2987
                MainDescription($"({FeaturesResources.range_variable}) List<int> x"));
2988 2989
        }

2990
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2991
        public async Task Query10()
2992
        {
C
CyrusNajmabadi 已提交
2993 2994
            await TestAsync(
@"using System.Collections.Generic;
2995
using System.Linq;
C
CyrusNajmabadi 已提交
2996

2997 2998 2999 3000 3001 3002 3003 3004
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y in $$x
                select y;
    }
C
CyrusNajmabadi 已提交
3005
}",
3006
                MainDescription($"({FeaturesResources.range_variable}) List<int> x"));
3007 3008
        }

3009
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3010
        public async Task Query11()
3011
        {
C
CyrusNajmabadi 已提交
3012 3013
            await TestAsync(
@"using System.Collections.Generic;
3014
using System.Linq;
C
CyrusNajmabadi 已提交
3015

3016 3017 3018 3019 3020 3021 3022 3023
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y$$ in x
                select y;
    }
C
CyrusNajmabadi 已提交
3024
}",
3025
                MainDescription($"({FeaturesResources.range_variable}) int y"));
3026 3027
        }

3028
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3029
        public async Task Query12()
3030
        {
C
CyrusNajmabadi 已提交
3031 3032
            await TestAsync(
@"using System.Collections.Generic;
3033
using System.Linq;
C
CyrusNajmabadi 已提交
3034

3035 3036 3037 3038 3039 3040 3041 3042
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y in x
                select $$y;
    }
C
CyrusNajmabadi 已提交
3043
}",
3044
                MainDescription($"({FeaturesResources.range_variable}) int y"));
3045 3046
        }

J
Jared Parsons 已提交
3047
        [WorkItem(543205, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543205")]
3048
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3049
        public async Task TestErrorGlobal()
3050
        {
C
CyrusNajmabadi 已提交
3051 3052 3053
            await TestAsync(
@"extern alias global;

3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064
class myClass
{
    static int Main()
    {
        $$global::otherClass oc = new global::otherClass();
        return 0;
    }
}",
                MainDescription("<global namespace>"));
        }

3065
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3066
        public async Task DontRemoveAttributeSuffixAndProduceInvalidIdentifier1()
3067
        {
C
CyrusNajmabadi 已提交
3068 3069 3070
            await TestAsync(
@"using System;

3071 3072 3073 3074
class classAttribute : Attribute
{
    private classAttribute x$$;
}",
3075
                MainDescription($"({FeaturesResources.field}) classAttribute classAttribute.x"));
3076 3077
        }

J
Jared Parsons 已提交
3078
        [WorkItem(544026, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544026")]
3079
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3080
        public async Task DontRemoveAttributeSuffix2()
3081
        {
C
CyrusNajmabadi 已提交
3082 3083 3084
            await TestAsync(
@"using System;

3085 3086 3087 3088
class class1Attribute : Attribute
{
    private class1Attribute x$$;
}",
3089
                MainDescription($"({FeaturesResources.field}) class1Attribute class1Attribute.x"));
3090 3091
        }

3092
        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
3093
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3094
        public async Task AttributeQuickInfoBindsToClassTest()
3095
        {
C
CyrusNajmabadi 已提交
3096 3097
            await TestAsync(
@"using System;
3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110

/// <summary>
/// class comment
/// </summary>
[Some$$]
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
    }
C
CyrusNajmabadi 已提交
3111
}",
3112 3113 3114 3115
                Documentation("class comment"));
        }

        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
3116
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3117
        public async Task AttributeConstructorQuickInfo()
3118
        {
C
CyrusNajmabadi 已提交
3119 3120
            await TestAsync(
@"using System;
3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133

/// <summary>
/// class comment
/// </summary>
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
        var s = new Some$$Attribute();
    }
C
CyrusNajmabadi 已提交
3134
}",
3135 3136 3137
                Documentation("ctor comment"));
        }

3138
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3139
        public async Task TestLabel()
3140
        {
3141 3142 3143 3144 3145 3146 3147
            await TestInClassAsync(
@"void M()
{
Foo:
    int Foo;
    goto Foo$$;
}",
3148
                MainDescription($"({FeaturesResources.label}) Foo"));
3149 3150
        }

J
Jared Parsons 已提交
3151
        [WorkItem(542613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542613")]
3152
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3153
        public async Task TestUnboundGeneric()
3154
        {
C
CyrusNajmabadi 已提交
3155 3156
            await TestAsync(
@"using System;
3157
using System.Collections.Generic;
C
CyrusNajmabadi 已提交
3158

3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169
class C
{
    void M()
    {
        Type t = typeof(L$$ist<>);
    }
}",
                MainDescription("class System.Collections.Generic.List<T>"),
                NoTypeParameterMap);
        }

J
Jared Parsons 已提交
3170
        [WorkItem(543113, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543113")]
3171
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3172
        public async Task TestAnonymousTypeNew1()
3173
        {
C
CyrusNajmabadi 已提交
3174 3175
            await TestAsync(
@"class C
3176 3177 3178 3179 3180 3181 3182 3183 3184
{
    void M()
    {
        var v = $$new { };
    }
}",
                MainDescription(@"AnonymousType 'a"),
                NoTypeParameterMap,
                AnonymousTypes(
3185
$@"
3186 3187
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{  }}"));
3188 3189
        }

J
Jared Parsons 已提交
3190
        [WorkItem(543873, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543873")]
3191
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3192
        public async Task TestNestedAnonymousType()
3193 3194 3195
        {
            // verify nested anonymous types are listed in the same order for different properties
            // verify first property
3196 3197 3198 3199
            await TestInMethodAsync(
@"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } };

x[0].$$Address",
3200 3201 3202
                MainDescription(@"'b 'a.Address { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3203
$@"
3204 3205 3206
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ string Name, 'b Address }}
    'b {FeaturesResources.is_} new {{ string Street, string Zip }}"));
3207 3208

            // verify second property
3209 3210 3211 3212
            await TestInMethodAsync(
@"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } };

x[0].$$Name",
3213 3214 3215
                MainDescription(@"string 'a.Name { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3216
$@"
3217 3218 3219
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ string Name, 'b Address }}
    'b {FeaturesResources.is_} new {{ string Street, string Zip }}"));
3220 3221
        }

3222
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
3223
        [WorkItem(543183, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543183")]
C
Cyrus Najmabadi 已提交
3224
        public async Task TestAssignmentOperatorInAnonymousType()
3225
        {
C
CyrusNajmabadi 已提交
3226 3227
            await TestAsync(
@"class C
3228 3229 3230 3231 3232
{
    void M()
    {
        var a = new { A $$= 0 };
    }
C
CyrusNajmabadi 已提交
3233
}");
3234 3235
        }

3236
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3237
        [WorkItem(10731, "DevDiv_Projects/Roslyn")]
C
Cyrus Najmabadi 已提交
3238
        public async Task TestErrorAnonymousTypeDoesntShow()
3239
        {
3240 3241
            await TestInMethodAsync(
@"var a = new { new { N = 0 }.N, new { } }.$$N;",
3242 3243 3244
                MainDescription(@"int 'a.N { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3245
$@"
3246 3247
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ int N }}"));
3248 3249
        }

3250
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
3251
        [WorkItem(543553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543553")]
C
Cyrus Najmabadi 已提交
3252
        public async Task TestArrayAssignedToVar()
3253
        {
C
CyrusNajmabadi 已提交
3254 3255
            await TestAsync(
@"class C
3256 3257 3258 3259 3260
{
    static void M(string[] args)
    {
        v$$ar a = args;
    }
C
CyrusNajmabadi 已提交
3261
}",
3262 3263 3264
                MainDescription("string[]"));
        }

J
Jared Parsons 已提交
3265
        [WorkItem(529139, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529139")]
3266
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3267
        public async Task ColorColorRangeVariable()
3268
        {
C
CyrusNajmabadi 已提交
3269 3270
            await TestAsync(
@"using System.Collections.Generic;
3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285
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;
            }
        }
    }
C
CyrusNajmabadi 已提交
3286
}",
3287
                MainDescription($"({FeaturesResources.range_variable}) N1.yield yield"));
3288 3289
        }

J
Jared Parsons 已提交
3290
        [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")]
3291
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3292
        public async Task QuickInfoOnOperator()
3293
        {
C
CyrusNajmabadi 已提交
3294 3295 3296
            await TestAsync(
@"using System.Collections.Generic;

3297 3298 3299 3300 3301 3302
class Program
{
    static void Main(string[] args)
    {
        var v = new Program() $$+ string.Empty;
    }
C
CyrusNajmabadi 已提交
3303

3304 3305 3306 3307
    public static implicit operator Program(string s)
    {
        return null;
    }
C
CyrusNajmabadi 已提交
3308

3309 3310 3311 3312 3313
    public static IEnumerable<Program> operator +(Program p1, Program p2)
    {
        yield return p1;
        yield return p2;
    }
C
CyrusNajmabadi 已提交
3314
}",
3315 3316 3317
                MainDescription("IEnumerable<Program> Program.operator +(Program p1, Program p2)"));
        }

3318
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3319
        public async Task TestConstantField()
3320
        {
C
CyrusNajmabadi 已提交
3321 3322 3323 3324
            await TestAsync(
@"class C
{
    const int $$F = 1;",
3325
                MainDescription($"({FeaturesResources.constant}) int C.F = 1"));
3326 3327
        }

3328
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3329
        public async Task TestMultipleConstantFields()
3330
        {
C
CyrusNajmabadi 已提交
3331 3332 3333 3334
            await TestAsync(
@"class C
{
    public const double X = 1.0, Y = 2.0, $$Z = 3.5;",
3335
                MainDescription($"({FeaturesResources.constant}) double C.Z = 3.5"));
3336 3337
        }

3338
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3339
        public async Task TestConstantDependencies()
3340
        {
C
CyrusNajmabadi 已提交
3341 3342
            await TestAsync(
@"class A
3343 3344 3345 3346
{
    public const int $$X = B.Z + 1;
    public const int Y = 10;
}
C
CyrusNajmabadi 已提交
3347

3348 3349 3350 3351
class B
{
    public const int Z = A.Y + 1;
}",
3352
                MainDescription($"({FeaturesResources.constant}) int A.X = B.Z + 1"));
3353 3354
        }

3355
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3356
        public async Task TestConstantCircularDependencies()
3357
        {
C
CyrusNajmabadi 已提交
3358 3359
            await TestAsync(
@"class A
3360 3361 3362
{
    public const int X = B.Z + 1;
}
C
CyrusNajmabadi 已提交
3363

3364 3365 3366 3367
class B
{
    public const int Z$$ = A.X + 1;
}",
3368
                MainDescription($"({FeaturesResources.constant}) int B.Z = A.X + 1"));
3369 3370
        }

J
Jared Parsons 已提交
3371
        [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")]
3372
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3373
        public async Task TestConstantOverflow()
3374
        {
C
CyrusNajmabadi 已提交
3375 3376
            await TestAsync(
@"class B
3377 3378 3379
{
    public const int Z$$ = int.MaxValue + 1;
}",
3380
                MainDescription($"({FeaturesResources.constant}) int B.Z = int.MaxValue + 1"));
3381 3382
        }

J
Jared Parsons 已提交
3383
        [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")]
3384
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3385
        public async Task TestConstantOverflowInUncheckedContext()
3386
        {
C
CyrusNajmabadi 已提交
3387 3388
            await TestAsync(
@"class B
3389 3390 3391
{
    public const int Z$$ = unchecked(int.MaxValue + 1);
}",
3392
                MainDescription($"({FeaturesResources.constant}) int B.Z = unchecked(int.MaxValue + 1)"));
3393 3394
        }

3395
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3396
        public async Task TestEnumInConstantField()
3397
        {
C
CyrusNajmabadi 已提交
3398 3399
            await TestAsync(
@"public class EnumTest
3400
{
C
CyrusNajmabadi 已提交
3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411
    enum Days
    {
        Sun,
        Mon,
        Tue,
        Wed,
        Thu,
        Fri,
        Sat
    };

3412 3413 3414 3415 3416
    static void Main()
    {
        const int $$x = (int)Days.Sun;
    }
}",
3417
                MainDescription($"({FeaturesResources.local_constant}) int x = (int)Days.Sun"));
3418 3419
        }

3420
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3421
        public async Task TestConstantInDefaultExpression()
3422
        {
C
CyrusNajmabadi 已提交
3423 3424
            await TestAsync(
@"public class EnumTest
3425
{
C
CyrusNajmabadi 已提交
3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436
    enum Days
    {
        Sun,
        Mon,
        Tue,
        Wed,
        Thu,
        Fri,
        Sat
    };

3437 3438 3439 3440 3441
    static void Main()
    {
        const Days $$x = default(Days);
    }
}",
3442
                MainDescription($"({FeaturesResources.local_constant}) Days x = default(Days)"));
3443 3444
        }

3445
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3446
        public async Task TestConstantParameter()
3447
        {
C
CyrusNajmabadi 已提交
3448 3449 3450 3451 3452
            await TestAsync(
@"class C
{
    void Bar(int $$b = 1);
}",
3453
                MainDescription($"({FeaturesResources.parameter}) int b = 1"));
3454 3455
        }

3456
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3457
        public async Task TestConstantLocal()
3458
        {
C
CyrusNajmabadi 已提交
3459 3460 3461 3462 3463 3464 3465
            await TestAsync(
@"class C
{
    void Bar()
    {
        const int $$loc = 1;
    }",
3466
                MainDescription($"({FeaturesResources.local_constant}) int loc = 1"));
3467 3468
        }

J
Jared Parsons 已提交
3469
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3470
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3471
        public async Task TestErrorType1()
3472
        {
3473 3474
            await TestInMethodAsync(
@"var $$v1 = new Foo();",
3475
                MainDescription($"({FeaturesResources.local_variable}) Foo v1"));
3476 3477
        }

J
Jared Parsons 已提交
3478
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3479
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3480
        public async Task TestErrorType2()
3481
        {
3482 3483
            await TestInMethodAsync(
@"var $$v1 = v1;",
3484
                MainDescription($"({FeaturesResources.local_variable}) var v1"));
3485 3486
        }

J
Jared Parsons 已提交
3487
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3488
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3489
        public async Task TestErrorType3()
3490
        {
3491 3492
            await TestInMethodAsync(
@"var $$v1 = new Foo<Bar>();",
3493
                MainDescription($"({FeaturesResources.local_variable}) Foo<Bar> v1"));
3494 3495
        }

J
Jared Parsons 已提交
3496
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3497
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3498
        public async Task TestErrorType4()
3499
        {
3500 3501
            await TestInMethodAsync(
@"var $$v1 = &(x => x);",
3502
                MainDescription($"({FeaturesResources.local_variable}) ?* v1"));
3503 3504
        }

J
Jared Parsons 已提交
3505
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3506
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3507
        public async Task TestErrorType5()
3508
        {
C
Cyrus Najmabadi 已提交
3509
            await TestInMethodAsync("var $$v1 = &v1",
3510
                MainDescription($"({FeaturesResources.local_variable}) var* v1"));
3511 3512
        }

J
Jared Parsons 已提交
3513
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3514
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3515
        public async Task TestErrorType6()
3516
        {
C
Cyrus Najmabadi 已提交
3517
            await TestInMethodAsync("var $$v1 = new Foo[1]",
3518
                MainDescription($"({FeaturesResources.local_variable}) Foo[] v1"));
3519 3520
        }

J
Jared Parsons 已提交
3521
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3522
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3523
        public async Task TestErrorType7()
3524
        {
3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536
            await TestInClassAsync(
@"class C
{
    void Method()
    {
    }

    void Foo()
    {
        var $$v1 = MethodGroup;
    }
}",
3537
                MainDescription($"({FeaturesResources.local_variable}) ? v1"));
3538 3539
        }

J
Jared Parsons 已提交
3540
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3541
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3542
        public async Task TestErrorType8()
3543
        {
C
Cyrus Najmabadi 已提交
3544
            await TestInMethodAsync("var $$v1 = Unknown",
3545
                MainDescription($"({FeaturesResources.local_variable}) ? v1"));
3546 3547
        }

J
Jared Parsons 已提交
3548
        [WorkItem(545072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545072")]
3549
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3550
        public async Task TestDelegateSpecialTypes()
3551
        {
C
CyrusNajmabadi 已提交
3552 3553
            await TestAsync(
@"delegate void $$F(int x);",
3554 3555 3556
                MainDescription("delegate void F(int x)"));
        }

J
Jared Parsons 已提交
3557
        [WorkItem(545108, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545108")]
3558
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3559
        public async Task TestNullPointerParameter()
3560
        {
C
CyrusNajmabadi 已提交
3561 3562 3563 3564 3565 3566 3567
            await TestAsync(
@"class C
{
    unsafe void $$Foo(int* x = null)
    {
    }
}",
3568 3569 3570
                MainDescription("void C.Foo([int* x = null])"));
        }

J
Jared Parsons 已提交
3571
        [WorkItem(545098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545098")]
3572
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3573
        public async Task TestLetIdentifier1()
3574
        {
C
Cyrus Najmabadi 已提交
3575
            await TestInMethodAsync("var q = from e in \"\" let $$y = 1 let a = new { y } select a;",
3576
                MainDescription($"({FeaturesResources.range_variable}) int y"));
3577 3578
        }

J
Jared Parsons 已提交
3579
        [WorkItem(545295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545295")]
3580
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3581
        public async Task TestNullableDefaultValue()
3582
        {
C
CyrusNajmabadi 已提交
3583 3584 3585 3586 3587 3588 3589
            await TestAsync(
@"class Test
{
    void $$Method(int? t1 = null)
    {
    }
}",
3590 3591 3592
                MainDescription("void Test.Method([int? t1 = null])"));
        }

J
Jared Parsons 已提交
3593
        [WorkItem(529586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529586")]
3594
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3595
        public async Task TestInvalidParameterInitializer()
3596
        {
C
Cyrus Najmabadi 已提交
3597
            await TestAsync(
C
CyrusNajmabadi 已提交
3598 3599 3600 3601 3602 3603 3604 3605
@"class Program
{
    void M1(float $$j1 = ""Hello""
+
""World"")
    {
    }
}",
3606
                MainDescription($@"({FeaturesResources.parameter}) float j1 = ""Hello"" + ""World"""));
3607 3608
        }

J
Jared Parsons 已提交
3609
        [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")]
3610
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3611
        public async Task TestComplexConstLocal()
3612
        {
C
Cyrus Najmabadi 已提交
3613
            await TestAsync(
3614 3615 3616 3617 3618 3619 3620 3621
@"class Program
{
    void Main()
    {
        const int MEGABYTE = 1024 *
            1024 + true;
        Blah($$MEGABYTE);
    }
C
CyrusNajmabadi 已提交
3622
}",
3623
                MainDescription($@"({FeaturesResources.local_constant}) int MEGABYTE = 1024 * 1024 + true"));
3624 3625
        }

J
Jared Parsons 已提交
3626
        [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")]
3627
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3628
        public async Task TestComplexConstField()
3629
        {
C
Cyrus Najmabadi 已提交
3630
            await TestAsync(
3631 3632
@"class Program
{
C
CyrusNajmabadi 已提交
3633 3634
    const int a = true
        -
3635
        false;
C
CyrusNajmabadi 已提交
3636

3637 3638 3639 3640 3641
    void Main()
    {
        Foo($$a);
    }
}",
3642
                MainDescription($"({FeaturesResources.constant}) int Program.a = true - false"));
3643 3644
        }

3645
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3646
        public async Task TestTypeParameterCrefDoesNotHaveQuickInfo()
3647
        {
C
Cyrus Najmabadi 已提交
3648
            await TestAsync(
3649 3650 3651 3652 3653 3654 3655 3656 3657
@"class C<T>
{
    ///  <see cref=""C{X$$}""/>
    static void Main(string[] args)
    {
    }
}");
        }

3658
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3659
        public async Task TestCref1()
3660
        {
C
Cyrus Najmabadi 已提交
3661
            await TestAsync(
3662 3663 3664 3665 3666 3667 3668 3669 3670 3671
@"class Program
{
    ///  <see cref=""Mai$$n""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

3672
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3673
        public async Task TestCref2()
3674
        {
C
Cyrus Najmabadi 已提交
3675
            await TestAsync(
3676 3677 3678 3679 3680 3681 3682 3683 3684 3685
@"class Program
{
    ///  <see cref=""$$Main""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

3686
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3687
        public async Task TestCref3()
3688
        {
C
Cyrus Najmabadi 已提交
3689
            await TestAsync(
3690 3691 3692 3693 3694 3695 3696 3697 3698
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

3699
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3700
        public async Task TestCref4()
3701
        {
C
Cyrus Najmabadi 已提交
3702
            await TestAsync(
3703 3704 3705 3706 3707 3708 3709 3710 3711
@"class Program
{
    ///  <see cref=""Main$$""/>
    static void Main(string[] args)
    {
    }
}");
        }

3712
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3713
        public async Task TestCref5()
3714
        {
C
Cyrus Najmabadi 已提交
3715
            await TestAsync(
3716 3717 3718 3719 3720 3721 3722 3723 3724
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

J
Jared Parsons 已提交
3725
        [WorkItem(546849, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546849")]
3726
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3727
        public async Task TestIndexedProperty()
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 3757 3758 3759 3760 3761 3762 3763 3764
        {
            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";

C
Cyrus Najmabadi 已提交
3765
            await TestWithReferenceAsync(sourceCode: markup,
3766 3767 3768 3769 3770 3771
                referencedCode: referencedCode,
                sourceLanguage: LanguageNames.CSharp,
                referencedLanguage: LanguageNames.VisualBasic,
                expectedResults: MainDescription("string CCC.IndexProp[int p1, [int p2 = 0]] { get; set; }"));
        }

J
Jared Parsons 已提交
3772
        [WorkItem(546918, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546918")]
3773
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3774
        public async Task TestUnconstructedGeneric()
3775
        {
C
Cyrus Najmabadi 已提交
3776
            await TestAsync(
C
CyrusNajmabadi 已提交
3777 3778 3779 3780
@"class A<T>
{
    enum SortOrder
    {
3781 3782 3783 3784
        Ascending,
        Descending,
        None
    }
C
CyrusNajmabadi 已提交
3785 3786 3787

    void Foo()
    {
3788 3789 3790 3791 3792 3793
        var b = $$SortOrder.Ascending;
    }
}",
                MainDescription(@"enum A<T>.SortOrder"));
        }

J
Jared Parsons 已提交
3794
        [WorkItem(546970, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546970")]
3795
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3796
        public async Task TestUnconstructedGenericInCRef()
3797
        {
C
Cyrus Najmabadi 已提交
3798
            await TestAsync(
C
CyrusNajmabadi 已提交
3799 3800 3801 3802
@"/// <see cref=""$$C{T}"" />
class C<T>
{
}",
3803 3804 3805
                MainDescription(@"class C<T>"));
        }

3806
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3807
        public async Task TestAwaitableMethod()
3808 3809 3810 3811 3812 3813 3814 3815 3816
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    async Task Foo()
    {
        Fo$$o();
    }
}";
3817
            var description = $"({CSharpFeaturesResources.awaitable}) Task C.Foo()";
3818

3819
            var documentation = $@"
3820
{WorkspacesResources.Usage_colon}
R
Ravi Chande 已提交
3821
  {SyntaxFacts.GetText(SyntaxKind.AwaitKeyword)} Foo();";
3822

C
Cyrus Najmabadi 已提交
3823
            await VerifyWithMscorlib45Async(markup, new[] { MainDescription(description), Usage(documentation) });
3824 3825
        }

3826
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3827
        public async Task ObsoleteItem()
3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839
        {
            var markup = @"
using System;

class Program
{
    [Obsolete]
    public void foo()
    {
        fo$$o();
    }
}";
3840
            await TestAsync(markup, MainDescription($"[{CSharpFeaturesResources.deprecated}] void Program.foo()"));
3841 3842
        }

J
Jared Parsons 已提交
3843
        [WorkItem(751070, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751070")]
3844
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3845
        public async Task DynamicOperator()
3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860
        {
            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;
    }
}";
C
Cyrus Najmabadi 已提交
3861
            await TestAsync(markup, MainDescription("dynamic dynamic.operator ==(dynamic left, dynamic right)"));
3862 3863
        }

3864
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3865
        public async Task TextOnlyDocComment()
3866
        {
C
CyrusNajmabadi 已提交
3867 3868
            await TestAsync(
@"/// <summary>
3869 3870 3871 3872 3873 3874 3875
///foo
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

3876
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3877
        public async Task TestTrimConcatMultiLine()
3878
        {
C
CyrusNajmabadi 已提交
3879 3880
            await TestAsync(
@"/// <summary>
3881 3882 3883 3884 3885 3886 3887 3888
/// foo
/// bar
/// </summary>
class C$$
{
}", Documentation("foo bar"));
        }

3889
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3890
        public async Task TestCref()
3891
        {
C
CyrusNajmabadi 已提交
3892 3893
            await TestAsync(
@"/// <summary>
3894 3895 3896 3897 3898 3899 3900 3901
/// <see cref=""C""/>
/// <seealso cref=""C""/>
/// </summary>
class C$$
{
}", Documentation("C C"));
        }

3902
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3903
        public async Task ExcludeTextOutsideSummaryBlock()
3904
        {
C
CyrusNajmabadi 已提交
3905 3906
            await TestAsync(
@"/// red
3907 3908 3909 3910 3911 3912 3913 3914 3915
/// <summary>
/// green
/// </summary>
/// yellow
class C$$
{
}", Documentation("green"));
        }

3916
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3917
        public async Task NewlineAfterPara()
3918
        {
C
CyrusNajmabadi 已提交
3919 3920
            await TestAsync(
@"/// <summary>
3921 3922 3923 3924 3925 3926 3927
/// <para>foo</para>
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

3928
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3929
        public async Task TextOnlyDocComment_Metadata()
3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946
        {
            var referenced = @"
/// <summary>
///foo
/// </summary>
public class C
{
}";

            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";
C
Cyrus Najmabadi 已提交
3947
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("foo"));
3948 3949
        }

3950
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3951
        public async Task TestTrimConcatMultiLine_Metadata()
3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969
        {
            var referenced = @"
/// <summary>
/// foo
/// bar
/// </summary>
public class C
{
}";

            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";
C
Cyrus Najmabadi 已提交
3970
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("foo bar"));
3971 3972
        }

3973
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3974
        public async Task TestCref_Metadata()
3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991
        {
            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";

            var referenced = @"/// <summary>
/// <see cref=""C""/>
/// <seealso cref=""C""/>
/// </summary>
public class C
{
}";
C
Cyrus Najmabadi 已提交
3992
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("C C"));
3993 3994
        }

3995
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3996
        public async Task ExcludeTextOutsideSummaryBlock_Metadata()
3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015
        {
            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";

            var referenced = @"
/// red
/// <summary>
/// green
/// </summary>
/// yellow
public class C
{
}";
C
Cyrus Najmabadi 已提交
4016
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("green"));
4017 4018
        }

4019
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4020
        public async Task Param()
4021
        {
C
CyrusNajmabadi 已提交
4022 4023
            await TestAsync(
@"/// <summary></summary>
4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034
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)"));
        }

4035
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4036
        public async Task Param_Metadata()
4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057
        {
            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)
    {
    }
}";
C
Cyrus Najmabadi 已提交
4058
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("First parameter of C.Foo<T>(string[], T)"));
4059 4060
        }

4061
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4062
        public async Task Param2()
4063
        {
C
CyrusNajmabadi 已提交
4064 4065
            await TestAsync(
@"/// <summary></summary>
4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076
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)"));
        }

4077
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4078
        public async Task Param2_Metadata()
4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095
        {
            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>
C
Cyrus Najmabadi 已提交
4096
    public void Foo<T>(string[] args, T otherParam)
4097 4098 4099
    {
    }
}";
C
Cyrus Najmabadi 已提交
4100
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("Another parameter of C.Foo<T>(string[], T)"));
4101 4102
        }

4103
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4104
        public async Task TypeParam()
4105
        {
C
CyrusNajmabadi 已提交
4106 4107
            await TestAsync(
@"/// <summary></summary>
4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118
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)"));
        }

4119
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4120
        public async Task UnboundCref()
4121
        {
C
CyrusNajmabadi 已提交
4122 4123
            await TestAsync(
@"/// <summary></summary>
4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134
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)"));
        }

4135
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4136
        public async Task CrefInConstructor()
4137
        {
C
CyrusNajmabadi 已提交
4138 4139
            await TestAsync(
@"public class TestClass
4140 4141 4142 4143 4144 4145 4146 4147 4148 4149
{
    /// <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."));
        }

4150
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4151
        public async Task CrefInConstructorOverloaded()
4152
        {
C
CyrusNajmabadi 已提交
4153 4154
            await TestAsync(
@"public class TestClass
4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166
{
    /// <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)
C
CyrusNajmabadi 已提交
4167 4168 4169
    {
    }
}", Documentation("This sample shows how to specify the TestClass(int) constructor as a cref attribute."));
4170 4171
        }

4172
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4173
        public async Task CrefInGenericMethod1()
4174
        {
C
CyrusNajmabadi 已提交
4175 4176
            await TestAsync(
@"public class TestClass
4177
{
C
CyrusNajmabadi 已提交
4178 4179 4180 4181 4182 4183 4184 4185 4186
    /// <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."));
4187 4188
        }

4189
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4190
        public async Task CrefInGenericMethod2()
4191
        {
C
CyrusNajmabadi 已提交
4192 4193
            await TestAsync(
@"public class TestClass
4194
{
C
CyrusNajmabadi 已提交
4195 4196 4197 4198 4199 4200 4201 4202 4203
    /// <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."));
4204 4205
        }

J
Jared Parsons 已提交
4206
        [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")]
4207
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4208
        public async Task CrefInMethodOverloading1()
4209
        {
C
CyrusNajmabadi 已提交
4210 4211
            await TestAsync(
@"public class TestClass
4212
{
C
CyrusNajmabadi 已提交
4213 4214 4215 4216 4217
    public static int GetZero()
    {
        GetGenericValu$$e();
        GetGenericValue(5);
    }
4218

C
CyrusNajmabadi 已提交
4219 4220 4221 4222 4223 4224 4225
    /// <summary> 
    /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
    /// </summary> 
    public static T GetGenericValue<T>(T para)
    {
        return para;
    }
4226

C
CyrusNajmabadi 已提交
4227 4228 4229 4230 4231 4232 4233
    /// <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."));
4234 4235
        }

J
Jared Parsons 已提交
4236
        [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")]
4237
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4238
        public async Task CrefInMethodOverloading2()
4239
        {
C
CyrusNajmabadi 已提交
4240 4241
            await TestAsync(
@"public class TestClass
4242
{
C
CyrusNajmabadi 已提交
4243 4244 4245 4246 4247
    public static int GetZero()
    {
        GetGenericValue();
        GetGenericVal$$ue(5);
    }
4248

C
CyrusNajmabadi 已提交
4249 4250 4251 4252 4253 4254 4255
    /// <summary> 
    /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
    /// </summary> 
    public static T GetGenericValue<T>(T para)
    {
        return para;
    }
4256

C
CyrusNajmabadi 已提交
4257 4258 4259 4260 4261 4262 4263
    /// <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"));
4264 4265
        }

4266
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4267
        public async Task CrefInGenericType()
4268
        {
C
CyrusNajmabadi 已提交
4269 4270 4271 4272 4273 4274 4275
            await TestAsync(
@"/// <summary> 
/// <remarks>This example shows how to specify the <see cref=""GenericClass{T}""/> cref.</remarks>
/// </summary> 
class Generic$$Class<T>
{
}",
4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287
    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."))));
        }

J
Jared Parsons 已提交
4288
        [WorkItem(812720, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/812720")]
4289
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4290
        public async Task ClassificationOfCrefsFromMetadata()
4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311
        {
            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()
    {
    }
}";
C
Cyrus Najmabadi 已提交
4312
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#",
4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325
                Documentation("See C.Foo() method",
                    ExpectedClassifications(
                        Text("See"),
                        WhiteSpace(" "),
                        Class("C"),
                        Punctuation.Text("."),
                        Identifier("Foo"),
                        Punctuation.OpenParen,
                        Punctuation.CloseParen,
                        WhiteSpace(" "),
                        Text("method"))));
        }

4326
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4327
        public async Task FieldAvailableInBothLinkedFiles()
4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347
        {
            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>";

4348
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.field}) int C.x"), Usage("") });
4349 4350
        }

4351
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4352
        public async Task FieldUnavailableInOneLinkedFile()
4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373
        {
            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>";
4374
            var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}", expectsWarningGlyph: true);
4375

C
Cyrus Najmabadi 已提交
4376
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4377 4378
        }

4379
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4380
        public async Task BindSymbolInOtherFile()
4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401
        {
            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>";
4402
            var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Not_Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}", expectsWarningGlyph: true);
4403

C
Cyrus Najmabadi 已提交
4404
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4405 4406
        }

4407
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4408
        public async Task FieldUnavailableInTwoLinkedFiles()
4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433
        {
            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(
4434
                $"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj3", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}",
4435 4436
                expectsWarningGlyph: true);

C
Cyrus Najmabadi 已提交
4437
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4438 4439
        }

4440
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4441
        public async Task ExcludeFilesWithInactiveRegions()
4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468
        {
            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>";
4469
            var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj3", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}", expectsWarningGlyph: true);
C
Cyrus Najmabadi 已提交
4470
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4471 4472
        }

J
Jared Parsons 已提交
4473
        [WorkItem(962353, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/962353")]
4474
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4475
        public async Task NoValidSymbolsInLinkedDocuments()
4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497
        {
            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>";
C
Cyrus Najmabadi 已提交
4498
            await VerifyWithReferenceWorkerAsync(markup);
4499 4500
        }

J
Jared Parsons 已提交
4501
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4502
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4503
        public async Task LocalsValidInLinkedDocuments()
4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522
        {
            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>";

4523
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage("") });
4524 4525
        }

J
Jared Parsons 已提交
4526
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4527
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4528
        public async Task LocalWarningInLinkedDocuments()
4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551
        {
            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>";

4552
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}", expectsWarningGlyph: true) });
4553 4554
        }

J
Jared Parsons 已提交
4555
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4556
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4557
        public async Task LabelsValidInLinkedDocuments()
4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576
        {
            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>";

4577
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.label}) LABEL"), Usage("") });
4578 4579
        }

J
Jared Parsons 已提交
4580
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4581
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4582
        public async Task RangeVariablesValidInLinkedDocuments()
4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602
        {
            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>";

4603
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.range_variable}) int y"), Usage("") });
4604 4605
        }

J
Jared Parsons 已提交
4606
        [WorkItem(1019766, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1019766")]
4607
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4608
        public async Task PointerAccessibility()
4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619
        {
            var markup = @"class C
{
    unsafe static void Main()
    {
        void* p = null;
        void* q = null;
        dynamic d = true;
        var x = p =$$= q == d;
    }
}";
C
Cyrus Najmabadi 已提交
4620
            await TestAsync(markup, MainDescription("bool void*.operator ==(void* left, void* right)"));
4621 4622
        }

J
Jared Parsons 已提交
4623
        [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")]
4624
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4625
        public async Task AwaitingTaskOfArrayType()
4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636
        {
            var markup = @"
using System.Threading.Tasks;

class Program
{
    async Task<int[]> M()
    {
        awa$$it M();
    }
}";
C
Cyrus Najmabadi 已提交
4637
            await TestAsync(markup, MainDescription("int[]"));
4638 4639
        }

J
Jared Parsons 已提交
4640
        [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")]
4641
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4642
        public async Task AwaitingTaskOfDynamic()
4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653
        {
            var markup = @"
using System.Threading.Tasks;

class Program
{
    async Task<dynamic> M()
    {
        awa$$it M();
    }
}";
C
Cyrus Najmabadi 已提交
4654
            await TestAsync(markup, MainDescription("dynamic"));
4655
        }
4656

4657
        [Fact, Trait(Traits.Feature, Traits.Features.Completion)]
C
Cyrus Najmabadi 已提交
4658
        public async Task MethodOverloadDifferencesIgnored()
4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if ONE
    void Do(int x){}
#endif
#if TWO
    void Do(string x){}
#endif
    void Shared()
    {
        this.Do$$
    }

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

            var expectedDescription = $"void C.Do(int x)";
C
Cyrus Najmabadi 已提交
4684
            await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription));
4685
        }
4686

4687
        [Fact, Trait(Traits.Feature, Traits.Features.Completion)]
C
Cyrus Najmabadi 已提交
4688
        public async Task MethodOverloadDifferencesIgnored_ContainingType()
4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    void Shared()
    {
        var x = GetThing().Do$$();
    }

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

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

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

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

            var expectedDescription = $"void Methods1.Do(string x)";
C
Cyrus Najmabadi 已提交
4737
            await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription));
4738
        }
4739 4740 4741

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(4868, "https://github.com/dotnet/roslyn/issues/4868")]
C
Cyrus Najmabadi 已提交
4742
        public async Task QuickInfoExceptions()
4743
        {
C
CyrusNajmabadi 已提交
4744 4745 4746
            await TestAsync(
@"using System;

4747 4748
namespace MyNs
{
C
CyrusNajmabadi 已提交
4749 4750 4751 4752 4753 4754 4755 4756
    class MyException1 : Exception
    {
    }

    class MyException2 : Exception
    {
    }

4757 4758 4759 4760 4761 4762
    class TestClass
    {
        /// <exception cref=""MyException1""></exception>
        /// <exception cref=""T:MyNs.MyException2""></exception>
        /// <exception cref=""System.Int32""></exception>
        /// <exception cref=""double""></exception>
4763
        /// <exception cref=""Not_A_Class_But_Still_Displayed""></exception>
4764 4765 4766 4767 4768
        void M()
        {
            M$$();
        }
    }
C
CyrusNajmabadi 已提交
4769
}",
4770
                Exceptions($"\r\n{WorkspacesResources.Exceptions_colon}\r\n  MyException1\r\n  MyException2\r\n  int\r\n  double\r\n  Not_A_Class_But_Still_Displayed"));
4771
        }
4772 4773 4774

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(1516, "https://github.com/dotnet/roslyn/issues/1516")]
C
Cyrus Najmabadi 已提交
4775
        public async Task QuickInfoWithNonStandardSeeAttributesAppear()
4776
        {
C
CyrusNajmabadi 已提交
4777 4778
            await TestAsync(
@"class C
4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789
{
    /// <summary>
    /// <see cref=""System.String"" />
    /// <see href=""http://microsoft.com"" />
    /// <see langword=""null"" />
    /// <see unsupported-attribute=""cat"" />
    /// </summary>
    void M()
    {
        M$$();
    }
C
CyrusNajmabadi 已提交
4790
}",
4791 4792
                Documentation(@"string http://microsoft.com null cat"));
        }
4793 4794 4795

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(6657, "https://github.com/dotnet/roslyn/issues/6657")]
4796
        public async Task OptionalParameterFromPreviousSubmission()
4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807
        {
            const string workspaceDefinition = @"
<Workspace>
    <Submission Language=""C#"" CommonReferences=""true"">
        void M(int x = 1) { }
    </Submission>
    <Submission Language=""C#"" CommonReferences=""true"">
        M(x$$: 2)
    </Submission>
</Workspace>
";
C
Cyrus Najmabadi 已提交
4808
            using (var workspace = await TestWorkspace.CreateAsync(XElement.Parse(workspaceDefinition), workspaceKind: WorkspaceKind.Interactive))
4809
            {
4810
                await TestWithOptionsAsync(workspace, MainDescription("(parameter) int x = 1"));
4811 4812
            }
        }
C
CyrusNajmabadi 已提交
4813 4814 4815 4816

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TupleProperty()
        {
4817 4818
            await TestInMethodAsync(
@"interface I
C
CyrusNajmabadi 已提交
4819 4820 4821
{
    (int, int) Name { get; set; }
}
4822

C
CyrusNajmabadi 已提交
4823 4824 4825 4826
class C : I
{
    (int, int) I.Name$$
    {
4827 4828 4829 4830 4831 4832 4833 4834
        get
        {
            throw new System.Exception();
        }

        set
        {
        }
C
CyrusNajmabadi 已提交
4835 4836 4837 4838
    }
}",
                MainDescription("(int, int) C.Name { get; set; }"));
        }
4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestRefMethod()
        {
            await TestInMethodAsync(
@"using System;

class Program
{
    static void Main(string[] args)
    {
        ref int i = ref $$foo();
    }

    private static ref int foo()
    {
        throw new NotImplementedException();
    }
}",
                MainDescription("ref int Program.foo()"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestRefLocal()
        {
            await TestInMethodAsync(
@"using System;

class Program
{
    static void Main(string[] args)
    {
        ref int $$i = ref foo();
    }

    private static ref int foo()
    {
        throw new NotImplementedException();
    }
}",
                MainDescription($"({FeaturesResources.local_variable}) ref int i"));
        }
4881
    }
C
Cyrus Najmabadi 已提交
4882
}