SemanticQuickInfoSourceTests.cs 146.7 KB
Newer Older
S
Sam Harwell 已提交
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
CyrusNajmabadi 已提交
27
            using (var workspace = TestWorkspace.CreateCSharp(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
            var provider = new SemanticQuickInfoProvider();
41

42
            await TestWithOptionsAsync(document, provider, position, expectedResults);
43 44

            // speculative semantic model
45
            if (await CanUseSpeculativeSemanticModelAsync(document, position))
46 47 48 49 50 51 52
            {
                var buffer = testDocument.TextBuffer;
                using (var edit = buffer.CreateEdit())
                {
                    var currentSnapshot = buffer.CurrentSnapshot;
                    edit.Replace(0, currentSnapshot.Length, currentSnapshot.GetText());
                    edit.Apply();
53
                }
54

55
                await TestWithOptionsAsync(document, provider, position, expectedResults);
56 57 58
            }
        }

59
        private async Task TestWithOptionsAsync(Document document, SemanticQuickInfoProvider provider, int position, Action<object>[] expectedResults)
60
        {
C
Cyrus Najmabadi 已提交
61
            var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
            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 已提交
82
        private async Task VerifyWithMscorlib45Async(string markup, Action<object>[] expectedResults)
83 84 85 86 87 88 89 90 91 92
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""C#"" CommonReferencesNet45=""true"">
        <Document FilePath=""SourceDocument"">
{0}
        </Document>
    </Project>
</Workspace>", SecurityElement.Escape(markup));

C
CyrusNajmabadi 已提交
93
            using (var workspace = TestWorkspace.Create(xmlString))
94 95 96 97 98
            {
                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);

99
                var provider = new SemanticQuickInfoProvider();
100

C
Cyrus Najmabadi 已提交
101
                var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
                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 已提交
123
        protected override async Task TestAsync(string markup, params Action<object>[] expectedResults)
124
        {
C
Cyrus Najmabadi 已提交
125 126
            await TestWithOptionsAsync(Options.Regular, markup, expectedResults);
            await TestWithOptionsAsync(Options.Script, markup, expectedResults);
127 128
        }

C
Cyrus Najmabadi 已提交
129
        protected async Task TestWithUsingsAsync(string markup, params Action<object>[] expectedResults)
130 131 132 133 134 135 136
        {
            var markupWithUsings =
@"using System;
using System.Collections.Generic;
using System.Linq;
" + markup;

C
Cyrus Najmabadi 已提交
137
            await TestAsync(markupWithUsings, expectedResults);
138 139
        }

C
Cyrus Najmabadi 已提交
140
        protected Task TestInClassAsync(string markup, params Action<object>[] expectedResults)
141 142
        {
            var markupInClass = "class C { " + markup + " }";
C
Cyrus Najmabadi 已提交
143
            return TestWithUsingsAsync(markupInClass, expectedResults);
144 145
        }

C
Cyrus Najmabadi 已提交
146
        protected Task TestInMethodAsync(string markup, params Action<object>[] expectedResults)
147 148
        {
            var markupInMethod = "class C { void M() { " + markup + " } }";
C
Cyrus Najmabadi 已提交
149
            return TestWithUsingsAsync(markupInMethod, expectedResults);
150 151
        }

C
Cyrus Najmabadi 已提交
152
        private async Task TestWithReferenceAsync(string sourceCode,
153 154 155 156 157
            string referencedCode,
            string sourceLanguage,
            string referencedLanguage,
            params Action<object>[] expectedResults)
        {
C
Cyrus Najmabadi 已提交
158 159
            await TestWithMetadataReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults);
            await TestWithProjectReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults);
160 161 162 163

            // Multi-language projects are not supported.
            if (sourceLanguage == referencedLanguage)
            {
C
Cyrus Najmabadi 已提交
164
                await TestInSameProjectHelperAsync(sourceCode, referencedCode, sourceLanguage, expectedResults);
165 166 167
            }
        }

C
Cyrus Najmabadi 已提交
168
        private async Task TestWithMetadataReferenceHelperAsync(
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
            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 已提交
190
            await VerifyWithReferenceWorkerAsync(xmlString, expectedResults);
191 192
        }

C
Cyrus Najmabadi 已提交
193
        private async Task TestWithProjectReferenceHelperAsync(
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
            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 已提交
217
            await VerifyWithReferenceWorkerAsync(xmlString, expectedResults);
218 219
        }

C
Cyrus Najmabadi 已提交
220
        private async Task TestInSameProjectHelperAsync(
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
            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 已提交
238
            await VerifyWithReferenceWorkerAsync(xmlString, expectedResults);
239 240
        }

C
Cyrus Najmabadi 已提交
241
        private async Task VerifyWithReferenceWorkerAsync(string xmlString, params Action<object>[] expectedResults)
242
        {
C
CyrusNajmabadi 已提交
243
            using (var workspace = TestWorkspace.Create(xmlString))
244 245 246 247 248
            {
                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);

249
                var provider = new SemanticQuickInfoProvider();
250

C
Cyrus Najmabadi 已提交
251
                var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
                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 已提交
273
        protected async Task TestInvalidTypeInClassAsync(string code)
274 275
        {
            var codeInClass = "class C { " + code + " }";
C
Cyrus Najmabadi 已提交
276
            await TestAsync(codeInClass);
277 278
        }

279
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
280
        public async Task TestNamespaceInUsingDirective()
281
        {
C
CyrusNajmabadi 已提交
282 283
            await TestAsync(
@"using $$System;",
284 285 286
                MainDescription("namespace System"));
        }

287
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
288
        public async Task TestNamespaceInUsingDirective2()
289
        {
C
CyrusNajmabadi 已提交
290 291
            await TestAsync(
@"using System.Coll$$ections.Generic;",
292 293 294
                MainDescription("namespace System.Collections"));
        }

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

303
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
304
        public async Task TestNamespaceInUsingDirectiveWithAlias()
305
        {
C
CyrusNajmabadi 已提交
306
            await TestAsync(
307
@"using Goo = Sys$$tem.Console;",
308 309 310
                MainDescription("namespace System"));
        }

311
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
312
        public async Task TestTypeInUsingDirectiveWithAlias()
313
        {
C
CyrusNajmabadi 已提交
314
            await TestAsync(
315
@"using Goo = System.Con$$sole;",
316 317 318
                MainDescription("class System.Console"));
        }

J
Jared Parsons 已提交
319
        [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")]
320
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
321
        public async Task TestDocumentationInUsingDirectiveWithAlias()
322 323
        {
            var markup =
324 325 326
@"using I$$ = IGoo;
///<summary>summary for interface IGoo</summary>
interface IGoo {  }";
327

C
Cyrus Najmabadi 已提交
328
            await TestAsync(markup,
329 330
                MainDescription("interface IGoo"),
                Documentation("summary for interface IGoo"));
331 332
        }

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

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

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 TestDocumentationInUsingDirectiveWithAlias3()
351 352
        {
            var markup =
353 354 355
@"using I = IGoo;
///<summary>summary for interface IGoo</summary>
interface IGoo 
356
{  
357
    void Goo();
358 359 360
}
class C : I$$ { }";

C
Cyrus Najmabadi 已提交
361
            await TestAsync(markup,
362 363
                MainDescription("interface IGoo"),
                Documentation("summary for interface IGoo"));
364 365
        }

366
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
367
        public async Task TestThis()
368 369 370 371 372 373
        {
            var markup =
@"
///<summary>summary for Class C</summary>
class C { string M() {  return thi$$s.ToString(); } }";

C
Cyrus Najmabadi 已提交
374
            await TestWithUsingsAsync(markup,
375 376 377 378
                MainDescription("class C"),
                Documentation("summary for Class C"));
        }

379
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
380
        public async Task TestClassWithDocComment()
381 382 383 384 385 386
        {
            var markup =
@"
///<summary>Hello!</summary>
class C { void M() { $$C obj; } }";

C
Cyrus Najmabadi 已提交
387
            await TestAsync(markup,
388 389 390 391
                MainDescription("class C"),
                Documentation("Hello!"));
        }

392
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
393
        public async Task TestSingleLineDocComments()
394 395 396 397
        {
            // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedSingleLineComment

            // SingleLine doc comment with leading whitespace
C
CyrusNajmabadi 已提交
398 399 400 401 402 403 404 405 406
            await TestAsync(
@"///<summary>Hello!</summary>
class C
{
    void M()
    {
        $$C obj;
    }
}",
407 408 409 410
                MainDescription("class C"),
                Documentation("Hello!"));

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

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

            // SingleLine doc comment with leading whitespace and blank line
C
CyrusNajmabadi 已提交
437 438 439
            await TestAsync(
@"///<summary>Hello!
///</summary>
440

C
CyrusNajmabadi 已提交
441 442 443 444 445 446 447
class C
{
    void M()
    {
        $$C obj;
    }
}",
448 449 450 451
                MainDescription("class C"),
                Documentation("Hello!"));

            // SingleLine doc comment with '\r' line separators
C
Cyrus Najmabadi 已提交
452
            await TestAsync("///<summary>Hello!\r///</summary>\rclass C { void M() { $$C obj; } }",
453 454 455 456
                MainDescription("class C"),
                Documentation("Hello!"));
        }

457
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
458
        public async Task TestMultiLineDocComments()
459 460 461 462
        {
            // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedMultiLineComment

            // Multiline doc comment with leading whitespace
C
CyrusNajmabadi 已提交
463 464 465 466 467 468 469 470 471
            await TestAsync(
@"/**<summary>Hello!</summary>*/
class C
{
    void M()
    {
        $$C obj;
    }
}",
472 473 474 475
                MainDescription("class C"),
                Documentation("Hello!"));

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

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

            // Multiline doc comment with no per-line prefix
C
CyrusNajmabadi 已提交
505 506
            await TestAsync(
@"/**
507 508 509 510
  <summary>
  Hello!
  </summary>
*/
C
CyrusNajmabadi 已提交
511 512 513 514 515 516 517
class C
{
    void M()
    {
        $$C obj;
    }
}",
518 519 520 521
                MainDescription("class C"),
                Documentation("Hello!"));

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

            // Multiline doc comment with closing comment on final line
C
CyrusNajmabadi 已提交
539 540
            await TestAsync(
@"/**
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 '\r' line separators
C
Cyrus Najmabadi 已提交
554
            await TestAsync("/**\r* <summary>\r* Hello!\r* </summary>\r*/\rclass C { void M() { $$C obj; } }",
555 556 557 558
                MainDescription("class C"),
                Documentation("Hello!"));
        }

559
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
560
        public async Task TestMethodWithDocComment()
561 562 563 564 565 566
        {
            var markup =
@"
///<summary>Hello!</summary>
void M() { M$$() }";

C
Cyrus Najmabadi 已提交
567
            await TestInClassAsync(markup,
568 569 570 571
                MainDescription("void C.M()"),
                Documentation("Hello!"));
        }

572
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
573
        public async Task TestInt32()
574
        {
575 576
            await TestInClassAsync(
@"$$Int32 i;",
577 578 579
                MainDescription("struct System.Int32"));
        }

580
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
581
        public async Task TestBuiltInInt()
582
        {
583 584
            await TestInClassAsync(
@"$$int i;",
585 586 587
                MainDescription("struct System.Int32"));
        }

588
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
589
        public async Task TestString()
590
        {
591 592
            await TestInClassAsync(
@"$$String s;",
593 594 595
                MainDescription("class System.String"));
        }

596
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
597
        public async Task TestBuiltInString()
598
        {
599 600
            await TestInClassAsync(
@"$$string s;",
601 602 603
                MainDescription("class System.String"));
        }

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

612
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
613
        public async Task TestBoolean()
614
        {
615 616
            await TestInClassAsync(
@"$$Boolean b;",
617 618 619
                MainDescription("struct System.Boolean"));
        }

620
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
621
        public async Task TestBuiltInBool()
622
        {
623 624
            await TestInClassAsync(
@"$$bool b;",
625 626 627
                MainDescription("struct System.Boolean"));
        }

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

636
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
637
        public async Task TestBuiltInFloat()
638
        {
639 640
            await TestInClassAsync(
@"$$float f;",
641 642 643
                MainDescription("struct System.Single"));
        }

644
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
645
        public async Task TestVoidIsInvalid()
646
        {
647 648 649 650
            await TestInvalidTypeInClassAsync(
@"$$void M()
{
}");
651 652
        }

653
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
654
        public async Task TestInvalidPointer1_931958()
655
        {
656 657
            await TestInvalidTypeInClassAsync(
@"$$T* i;");
658 659
        }

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

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

674
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
675
        public async Task TestListOfString()
676
        {
677 678
            await TestInClassAsync(
@"$$List<string> l;",
679
                MainDescription("class System.Collections.Generic.List<T>"),
680
                TypeParameterMap($"\r\nT {FeaturesResources.is_} string"));
681 682
        }

683
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
684
        public async Task TestListOfSomethingFromSource()
685 686 687 688 689 690
        {
            var markup =
@"
///<summary>Generic List</summary>
public class GenericList<T> { Generic$$List<int> t; }";

C
Cyrus Najmabadi 已提交
691
            await TestAsync(markup,
692 693
                MainDescription("class GenericList<T>"),
                Documentation("Generic List"),
694
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
695 696
        }

697
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
698
        public async Task TestListOfT()
699
        {
700 701 702 703 704
            await TestInMethodAsync(
@"class C<T>
{
    $$List<T> l;
}",
705 706 707
                MainDescription("class System.Collections.Generic.List<T>"));
        }

708
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
709
        public async Task TestDictionaryOfIntAndString()
710
        {
711 712
            await TestInClassAsync(
@"$$Dictionary<int, string> d;",
713 714
                MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"),
                TypeParameterMap(
715 716
                    Lines($"\r\nTKey {FeaturesResources.is_} int",
                          $"TValue {FeaturesResources.is_} string")));
717 718
        }

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

733
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
734
        public async Task TestIEnumerableOfInt()
735
        {
736 737 738 739 740
            await TestInClassAsync(
@"$$IEnumerable<int> M()
{
    yield break;
}",
741
                MainDescription("interface System.Collections.Generic.IEnumerable<out T>"),
742
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
743 744
        }

745
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
746
        public async Task TestEventHandler()
747
        {
748 749
            await TestInClassAsync(
@"event $$EventHandler e;",
750 751 752
                MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)"));
        }

753
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
754
        public async Task TestTypeParameter()
755
        {
C
CyrusNajmabadi 已提交
756 757 758 759 760
            await TestAsync(
@"class C<T>
{
    $$T t;
}",
761
                MainDescription($"T {FeaturesResources.in_} C<T>"));
762 763
        }

J
Jared Parsons 已提交
764
        [WorkItem(538636, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538636")]
765
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
766
        public async Task TestTypeParameterWithDocComment()
767 768 769 770 771 772 773
        {
            var markup =
@"
///<summary>Hello!</summary>
///<typeparam name=""T"">T is Type Parameter</typeparam>
class C<T> { $$T t; }";

C
Cyrus Najmabadi 已提交
774
            await TestAsync(markup,
775
                MainDescription($"T {FeaturesResources.in_} C<T>"),
776 777 778
                Documentation("T is Type Parameter"));
        }

779
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
780
        public async Task TestTypeParameter1_Bug931949()
781
        {
C
CyrusNajmabadi 已提交
782 783 784 785 786
            await TestAsync(
@"class T1<T11>
{
    $$T11 t;
}",
787
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
788 789
        }

790
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
791
        public async Task TestTypeParameter2_Bug931949()
792
        {
C
CyrusNajmabadi 已提交
793 794 795 796 797
            await TestAsync(
@"class T1<T11>
{
    T$$11 t;
}",
798
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
799 800
        }

801
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
802
        public async Task TestTypeParameter3_Bug931949()
803
        {
C
CyrusNajmabadi 已提交
804 805 806 807 808
            await TestAsync(
@"class T1<T11>
{
    T1$$1 t;
}",
809
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
810 811
        }

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

823
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
824
        public async Task TestNullableOfInt()
825
        {
C
Cyrus Najmabadi 已提交
826
            await TestInClassAsync(@"$$Nullable<int> i; }",
827
                MainDescription("struct System.Nullable<T> where T : struct"),
828
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
829 830
        }

831
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
832
        public async Task TestGenericTypeDeclaredOnMethod1_Bug1946()
833
        {
C
CyrusNajmabadi 已提交
834 835 836 837 838 839 840 841
            await TestAsync(
@"class C
{
    static void Meth1<T1>($$T1 i) where T1 : struct
    {
        T1 i;
    }
}",
842
                MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct"));
843 844
        }

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

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

873
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
874
        public async Task TestGenericTypeParameterConstraint_Class()
875
        {
C
CyrusNajmabadi 已提交
876 877 878 879
            await TestAsync(
@"class C<T> where $$T : class
{
}",
880
                MainDescription($"T {FeaturesResources.in_} C<T> where T : class"));
881 882
        }

883
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
884
        public async Task TestGenericTypeParameterConstraint_Struct()
885
        {
C
CyrusNajmabadi 已提交
886 887 888 889
            await TestAsync(
@"struct S<T> where $$T : class
{
}",
890
                MainDescription($"T {FeaturesResources.in_} S<T> where T : class"));
891 892
        }

893
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
894
        public async Task TestGenericTypeParameterConstraint_Interface()
895
        {
C
CyrusNajmabadi 已提交
896 897 898 899
            await TestAsync(
@"interface I<T> where $$T : class
{
}",
900
                MainDescription($"T {FeaturesResources.in_} I<T> where T : class"));
901 902
        }

903
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
904
        public async Task TestGenericTypeParameterConstraint_Delegate()
905
        {
C
CyrusNajmabadi 已提交
906 907
            await TestAsync(
@"delegate void D<T>() where $$T : class;",
908
                MainDescription($"T {FeaturesResources.in_} D<T> where T : class"));
909 910
        }

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

918
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
919
        public async Task FullyQualifiedConstraint()
920
        {
C
Cyrus Najmabadi 已提交
921
            await TestAsync(@"class C<T> where $$T : System.Collections.Generic.IEnumerable<int>",
922
                MainDescription($"T {FeaturesResources.in_} C<T> where T : System.Collections.Generic.IEnumerable<int>"));
923 924
        }

925
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
926
        public async Task TestMethodReferenceInSameMethod()
927
        {
C
CyrusNajmabadi 已提交
928 929 930 931 932 933 934 935
            await TestAsync(
@"class C
{
    void M()
    {
        M$$();
    }
}",
936 937 938
                MainDescription("void C.M()"));
        }

939
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
940
        public async Task TestMethodReferenceInSameMethodWithDocComment()
941 942 943 944 945 946
        {
            var markup =
@"
///<summary>Hello World</summary>
void M() { M$$(); }";

C
Cyrus Najmabadi 已提交
947
            await TestInClassAsync(markup,
948 949 950 951
                MainDescription("void C.M()"),
                Documentation("Hello World"));
        }

952
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
953
        public async Task TestFieldInMethodBuiltIn()
954 955 956 957 958 959 960 961 962
        {
            var markup =
@"int field;

void M()
{
    field$$
}";

C
Cyrus Najmabadi 已提交
963
            await TestInClassAsync(markup,
964
                MainDescription($"({FeaturesResources.field}) int C.field"));
965 966
        }

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

void M()
{
    int f = field$$;
}",
977
                MainDescription($"({FeaturesResources.field}) int C.field"));
978 979
        }

980
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
981
        public async Task TestFieldInMethodBuiltInWithFieldInitializer()
982
        {
983 984 985 986 987
            await TestInClassAsync(
@"int field = 1;

void M()
{
C
CyrusNajmabadi 已提交
988
    int f = field $$;
989
}");
990 991
        }

992
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
993
        public async Task TestOperatorBuiltIn()
994
        {
995 996 997 998
            await TestInMethodAsync(
@"int x;

x = x$$+1;",
999 1000 1001
                MainDescription("int int.operator +(int left, int right)"));
        }

1002
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1003
        public async Task TestOperatorBuiltIn1()
1004
        {
1005 1006 1007 1008
            await TestInMethodAsync(
@"int x;

x = x$$ + 1;",
1009
                MainDescription($"({FeaturesResources.local_variable}) int x"));
1010 1011
        }

1012
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1013
        public async Task TestOperatorBuiltIn2()
1014
        {
1015 1016 1017 1018
            await TestInMethodAsync(
@"int x;

x = x+$$x;",
1019
                MainDescription($"({FeaturesResources.local_variable}) int x"));
1020 1021
        }

1022
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1023
        public async Task TestOperatorBuiltIn3()
1024
        {
1025 1026 1027 1028
            await TestInMethodAsync(
@"int x;

x = x +$$ x;",
1029 1030 1031
                MainDescription("int int.operator +(int left, int right)"));
        }

1032
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1033
        public async Task TestOperatorBuiltIn4()
1034
        {
1035 1036 1037 1038
            await TestInMethodAsync(
@"int x;

x = x + $$x;",
1039
                MainDescription($"({FeaturesResources.local_variable}) int x"));
1040 1041
        }

1042
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1043
        public async Task TestOperatorCustomTypeBuiltIn()
1044 1045 1046 1047 1048 1049 1050
        {
            var markup =
@"class C
{
    static void M() { C c; c = c +$$ c; }
}";

C
Cyrus Najmabadi 已提交
1051
            await TestAsync(markup);
1052 1053
        }

1054
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1055
        public async Task TestOperatorCustomTypeOverload()
1056 1057 1058 1059 1060 1061 1062 1063
        {
            var markup =
@"class C
{
    static void M() { C c; c = c +$$ c; }
    static C operator+(C a, C b) { return a; }
}";

C
Cyrus Najmabadi 已提交
1064
            await TestAsync(markup,
1065 1066 1067
                MainDescription("C C.operator +(C a, C b)"));
        }

1068
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1069
        public async Task TestFieldInMethodMinimal()
1070 1071 1072 1073 1074 1075 1076 1077 1078
        {
            var markup =
@"DateTime field;

void M()
{
    field$$
}";

C
Cyrus Najmabadi 已提交
1079
            await TestInClassAsync(markup,
1080
                MainDescription($"({FeaturesResources.field}) DateTime C.field"));
1081 1082
        }

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

void M()
{
    file$$
}";

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

1098
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1099
        public async Task TestMemberOfStructFromSource()
1100 1101 1102 1103 1104 1105
        {
            var markup =
@"struct MyStruct {
public static int SomeField; }
static class Test { int a = MyStruct.Some$$Field; }";

C
Cyrus Najmabadi 已提交
1106
            await TestAsync(markup,
1107
                MainDescription($"({FeaturesResources.field}) int MyStruct.SomeField"));
1108 1109
        }

J
Jared Parsons 已提交
1110
        [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")]
1111
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1112
        public async Task TestMemberOfStructFromSourceWithDocComment()
1113 1114 1115 1116 1117 1118 1119
        {
            var markup =
@"struct MyStruct {
///<summary>My Field</summary>
public static int SomeField; }
static class Test { int a = MyStruct.Some$$Field; }";

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

1125
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1126
        public async Task TestMemberOfStructInsideMethodFromSource()
1127 1128 1129 1130 1131 1132
        {
            var markup =
@"struct MyStruct {
public static int SomeField; }
static class Test { static void Method() { int a = MyStruct.Some$$Field; } }";

C
Cyrus Najmabadi 已提交
1133
            await TestAsync(markup,
1134
                MainDescription($"({FeaturesResources.field}) int MyStruct.SomeField"));
1135 1136
        }

J
Jared Parsons 已提交
1137
        [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")]
1138
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1139
        public async Task TestMemberOfStructInsideMethodFromSourceWithDocComment()
1140 1141 1142 1143 1144 1145 1146
        {
            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 已提交
1147
            await TestAsync(markup,
1148
                MainDescription($"({FeaturesResources.field}) int MyStruct.SomeField"),
1149 1150 1151
                Documentation("My Field"));
        }

1152
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1153
        public async Task TestMetadataFieldMinimal()
1154
        {
C
Cyrus Najmabadi 已提交
1155
            await TestInMethodAsync(@"DateTime dt = DateTime.MaxValue$$",
1156
                MainDescription($"({FeaturesResources.field}) DateTime DateTime.MaxValue"));
1157 1158
        }

1159
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1160
        public async Task TestMetadataFieldQualified1()
1161 1162 1163 1164 1165 1166 1167 1168 1169
        {
            // 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 已提交
1170
            await TestAsync(markup,
1171
                MainDescription($"({FeaturesResources.field}) System.DateTime System.DateTime.MaxValue"));
1172 1173
        }

1174
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1175
        public async Task TestMetadataFieldQualified2()
1176
        {
C
CyrusNajmabadi 已提交
1177 1178 1179
            await TestAsync(
@"class C
{
1180 1181 1182 1183 1184
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}",
1185
                MainDescription($"({FeaturesResources.field}) System.DateTime System.DateTime.MaxValue"));
1186 1187
        }

1188
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1189
        public async Task TestMetadataFieldQualified3()
1190
        {
C
CyrusNajmabadi 已提交
1191 1192 1193 1194 1195
            await TestAsync(
@"using System;

class C
{
1196 1197 1198 1199 1200
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}",
1201
                MainDescription($"({FeaturesResources.field}) DateTime DateTime.MaxValue"));
1202 1203
        }

1204
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1205
        public async Task ConstructedGenericField()
1206
        {
C
CyrusNajmabadi 已提交
1207 1208 1209 1210 1211
            await TestAsync(
@"class C<T>
{
    public T Field;
}
1212

C
CyrusNajmabadi 已提交
1213 1214 1215 1216
class D
{
    void M()
    {
1217 1218 1219
        new C<int>().Fi$$eld.ToString();
    }
}",
1220
                MainDescription($"({FeaturesResources.field}) int C<int>.Field"));
1221 1222
        }

1223
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1224
        public async Task UnconstructedGenericField()
1225
        {
C
CyrusNajmabadi 已提交
1226 1227 1228
            await TestAsync(
@"class C<T>
{
1229 1230
    public T Field;

C
CyrusNajmabadi 已提交
1231 1232
    void M()
    {
1233 1234 1235
        Fi$$eld.ToString();
    }
}",
1236
                MainDescription($"({FeaturesResources.field}) T C<T>.Field"));
1237 1238
        }

1239
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1240
        public async Task TestIntegerLiteral()
1241
        {
C
Cyrus Najmabadi 已提交
1242
            await TestInMethodAsync(@"int f = 37$$",
1243 1244 1245
                MainDescription("struct System.Int32"));
        }

1246
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1247
        public async Task TestTrueKeyword()
1248
        {
C
Cyrus Najmabadi 已提交
1249
            await TestInMethodAsync(@"bool f = true$$",
1250 1251 1252
                MainDescription("struct System.Boolean"));
        }

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

J
Jared Parsons 已提交
1260
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")]
1261
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1262
        public async Task TestAwaitKeywordOnGenericTaskReturningAsync()
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public async Task<int> Calc()
    {
        aw$$ait Calc();
        return 5;
    }
}";
1273
            await TestAsync(markup, MainDescription($"{FeaturesResources.Awaited_task_returns} struct System.Int32"));
1274 1275
        }

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

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

J
Jared Parsons 已提交
1307
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1308
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1309
        public async Task TestNestedAwaitKeywords1()
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
        {
            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();
    }
}";
1339 1340
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) {FeaturesResources.Awaited_task_returns} class System.Threading.Tasks.Task<TResult>"),
                         TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int"));
1341 1342
        }

J
Jared Parsons 已提交
1343
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")]
1344
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1345
        public async Task TestNestedAwaitKeywords2()
1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374
        {
            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();
    }
}";
1375
            await TestAsync(markup, MainDescription($"{FeaturesResources.Awaited_task_returns} struct System.Int32"));
1376 1377
        }

J
Jared Parsons 已提交
1378
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1379
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1380
        public async Task TestAwaitablePrefixOnCustomAwaiter()
1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401
        {
            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() { }
}";
1402
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class C"));
1403 1404
        }

J
Jared Parsons 已提交
1405
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1406
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1407
        public async Task TestTaskType()
1408 1409 1410 1411 1412 1413 1414 1415 1416
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    public void Calc()
    {
        Task$$ v1;
    }
}";
1417
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task"));
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 TestTaskOfTType()
1423 1424 1425 1426 1427 1428 1429 1430 1431 1432
        {
            var markup = @"using System;
using System.Threading.Tasks;
class C
{
    public void Calc()
    {
        Task$$<int> v1;
    }
}";
1433 1434
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task<TResult>"),
                         TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int"));
1435 1436
        }

1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453
        [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()"));
        }

1454
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1455
        public async Task TestStringLiteral()
1456
        {
1457
            await TestInMethodAsync(@"string f = ""Goo""$$",
1458 1459 1460
                MainDescription("class System.String"));
        }

1461
        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1462
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1463
        public async Task TestVerbatimStringLiteral()
1464
        {
C
Cyrus Najmabadi 已提交
1465
            await TestInMethodAsync(@"string f = @""cat""$$",
1466 1467 1468 1469
                MainDescription("class System.String"));
        }

        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1470
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1471
        public async Task TestInterpolatedStringLiteral()
1472
        {
C
Cyrus Najmabadi 已提交
1473 1474 1475 1476
            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"));
1477 1478 1479
        }

        [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")]
1480
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1481
        public async Task TestVerbatimInterpolatedStringLiteral()
1482
        {
C
Cyrus Najmabadi 已提交
1483 1484 1485 1486
            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"));
1487 1488
        }

1489
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1490
        public async Task TestCharLiteral()
1491
        {
C
Cyrus Najmabadi 已提交
1492
            await TestInMethodAsync(@"string f = 'x'$$",
1493 1494 1495
                MainDescription("struct System.Char"));
        }

1496
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1497
        public async Task DynamicKeyword()
1498
        {
1499 1500
            await TestInMethodAsync(
@"dyn$$amic dyn;",
1501
                MainDescription("dynamic"),
1502
                Documentation(FeaturesResources.Represents_an_object_whose_operations_will_be_resolved_at_runtime));
1503 1504
        }

1505
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1506
        public async Task DynamicField()
1507
        {
1508 1509 1510
            await TestInClassAsync(
@"dynamic dyn;

1511 1512
void M()
{
1513
    d$$yn.Goo();
1514
}",
1515
                MainDescription($"({FeaturesResources.field}) dynamic C.dyn"));
1516 1517
        }

1518
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1519
        public async Task LocalProperty_Minimal()
1520
        {
1521 1522 1523
            await TestInClassAsync(
@"DateTime Prop { get; set; }

1524 1525 1526 1527 1528 1529 1530
void M()
{
    P$$rop.ToString();
}",
                MainDescription("DateTime C.Prop { get; set; }"));
        }

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

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

1544
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1545
        public async Task LocalProperty_Minimal_PrivateSet1()
1546
        {
1547 1548 1549
            await TestInClassAsync(
@"protected internal int Prop { get; private set; }

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

1557
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1558
        public async Task LocalProperty_Qualified()
1559
        {
1560 1561 1562
            await TestInClassAsync(
@"System.IO.FileInfo Prop { get; set; }

1563 1564 1565 1566 1567 1568 1569
void M()
{
    P$$rop.ToString();
}",
                MainDescription("System.IO.FileInfo C.Prop { get; set; }"));
        }

1570
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1571
        public async Task NonLocalProperty_Minimal()
1572
        {
C
Cyrus Najmabadi 已提交
1573
            await TestInMethodAsync(@"DateTime.No$$w.ToString();",
1574 1575 1576
                MainDescription("DateTime DateTime.Now { get; }"));
        }

1577
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1578
        public async Task NonLocalProperty_Qualified()
1579
        {
1580 1581 1582 1583
            await TestInMethodAsync(
@"System.IO.FileInfo f;

f.Att$$ributes.ToString();",
1584 1585 1586
                MainDescription("System.IO.FileAttributes System.IO.FileSystemInfo.Attributes { get; set; }"));
        }

1587
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1588
        public async Task ConstructedGenericProperty()
1589
        {
C
CyrusNajmabadi 已提交
1590 1591 1592 1593
            await TestAsync(
@"class C<T>
{
    public T Property { get; set }
1594 1595
}

C
CyrusNajmabadi 已提交
1596 1597 1598 1599
class D
{
    void M()
    {
1600 1601 1602 1603 1604 1605
        new C<int>().Pro$$perty.ToString();
    }
}",
                MainDescription("int C<int>.Property { get; set; }"));
        }

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

C
CyrusNajmabadi 已提交
1614 1615
    void M()
    {
1616 1617 1618 1619 1620 1621
        Pro$$perty.ToString();
    }
}",
                MainDescription("T C<T>.Property { get; set; }"));
        }

1622
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1623
        public async Task ValueInProperty()
1624
        {
1625 1626 1627 1628 1629
            await TestInClassAsync(
@"public DateTime Property
{
    set
    {
1630
        goo = val$$ue;
1631 1632
    }
}",
1633
                MainDescription($"({FeaturesResources.parameter}) DateTime value"));
1634 1635
        }

1636
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1637
        public async Task EnumTypeName()
1638
        {
C
Cyrus Najmabadi 已提交
1639
            await TestInMethodAsync(@"Consol$$eColor c",
1640 1641 1642
                MainDescription("enum System.ConsoleColor"));
        }

1643
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1644
        public async Task EnumMemberNameFromMetadata()
1645
        {
C
Cyrus Najmabadi 已提交
1646
            await TestInMethodAsync(@"ConsoleColor c = ConsoleColor.Bla$$ck",
1647 1648 1649
                MainDescription("ConsoleColor.Black = 0"));
        }

1650
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1651
        public async Task FlagsEnumMemberNameFromMetadata1()
1652
        {
C
Cyrus Najmabadi 已提交
1653
            await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.Cl$$ass",
1654 1655 1656
                MainDescription("AttributeTargets.Class = 4"));
        }

1657
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1658
        public async Task FlagsEnumMemberNameFromMetadata2()
1659
        {
C
Cyrus Najmabadi 已提交
1660
            await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.A$$ll",
1661 1662 1663
                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"));
        }

1664
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1665
        public async Task EnumMemberNameFromSource1()
1666
        {
C
CyrusNajmabadi 已提交
1667 1668
            await TestAsync(
@"enum E
1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
{
    A = 1 << 0,
    B = 1 << 1,
    C = 1 << 2
}

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

1685
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1686
        public async Task EnumMemberNameFromSource2()
1687
        {
C
CyrusNajmabadi 已提交
1688 1689
            await TestAsync(
@"enum E
1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705
{
    A,
    B,
    C
}

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

1706
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1707
        public async Task Parameter_InMethod_Minimal()
1708
        {
1709 1710 1711 1712
            await TestInClassAsync(
@"void M(DateTime dt)
{
    d$$t.ToString();",
1713
                MainDescription($"({FeaturesResources.parameter}) DateTime dt"));
1714 1715
        }

1716
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1717
        public async Task Parameter_InMethod_Qualified()
1718
        {
1719 1720 1721 1722
            await TestInClassAsync(
@"void M(System.IO.FileInfo fileInfo)
{
    file$$Info.ToString();",
1723
                MainDescription($"({FeaturesResources.parameter}) System.IO.FileInfo fileInfo"));
1724 1725
        }

1726
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1727
        public async Task Parameter_FromReferenceToNamedParameter()
1728
        {
C
Cyrus Najmabadi 已提交
1729
            await TestInMethodAsync(@"Console.WriteLine(va$$lue: ""Hi"");",
1730
                MainDescription($"({FeaturesResources.parameter}) string value"));
1731 1732
        }

1733
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1734
        public async Task Parameter_DefaultValue()
1735 1736 1737
        {
            // NOTE: Dev10 doesn't show the default value, but it would be nice if we did.
            // NOTE: The "DefaultValue" property isn't implemented yet.
1738 1739 1740 1741 1742
            await TestInClassAsync(
@"void M(int param = 42)
{
    para$$m.ToString();
}",
1743
                MainDescription($"({FeaturesResources.parameter}) int param = 42"));
1744 1745
        }

1746
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1747
        public async Task Parameter_Params()
1748
        {
1749 1750 1751 1752 1753
            await TestInClassAsync(
@"void M(params DateTime[] arg)
{
    ar$$g.ToString();
}",
1754
                MainDescription($"({FeaturesResources.parameter}) params DateTime[] arg"));
1755 1756
        }

1757
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1758
        public async Task Parameter_Ref()
1759
        {
1760 1761 1762 1763 1764
            await TestInClassAsync(
@"void M(ref DateTime arg)
{
    ar$$g.ToString();
}",
1765
                MainDescription($"({FeaturesResources.parameter}) ref DateTime arg"));
1766 1767
        }

1768
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1769
        public async Task Parameter_Out()
1770
        {
1771 1772 1773 1774 1775
            await TestInClassAsync(
@"void M(out DateTime arg)
{
    ar$$g.ToString();
}",
1776
                MainDescription($"({FeaturesResources.parameter}) out DateTime arg"));
1777 1778
        }

1779
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1780
        public async Task Local_Minimal()
1781
        {
1782 1783 1784 1785
            await TestInMethodAsync(
@"DateTime dt;

d$$t.ToString();",
1786
                MainDescription($"({FeaturesResources.local_variable}) DateTime dt"));
1787 1788
        }

1789
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1790
        public async Task Local_Qualified()
1791
        {
1792 1793 1794 1795
            await TestInMethodAsync(
@"System.IO.FileInfo fileInfo;

file$$Info.ToString();",
1796
                MainDescription($"({FeaturesResources.local_variable}) System.IO.FileInfo fileInfo"));
1797 1798
        }

1799
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1800
        public async Task Method_MetadataOverload()
1801
        {
C
Cyrus Najmabadi 已提交
1802
            await TestInMethodAsync("Console.Write$$Line();",
1803
                MainDescription($"void Console.WriteLine() (+ 18 {FeaturesResources.overloads_})"));
1804 1805
        }

1806
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1807
        public async Task Method_SimpleWithOverload()
1808
        {
1809 1810 1811 1812 1813 1814 1815 1816 1817
            await TestInClassAsync(
@"void Method()
{
    Met$$hod();
}

void Method(int i)
{
}",
1818
                MainDescription($"void C.Method() (+ 1 {FeaturesResources.overload})"));
1819 1820
        }

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

void Method(int i)
{
}

void Method(DateTime dt)
{
}

void Method(System.IO.FileInfo fileInfo)
{
}",
1841
                MainDescription($"void C.Method(System.IO.FileInfo fileInfo) (+ 3 {FeaturesResources.overloads_})"));
1842 1843
        }

1844
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1845
        public async Task Method_SimpleInSameClass()
1846
        {
1847 1848 1849 1850 1851
            await TestInClassAsync(
@"DateTime GetDate(System.IO.FileInfo ft)
{
    Get$$Date(null);
}",
1852 1853 1854
                MainDescription("DateTime C.GetDate(System.IO.FileInfo ft)"));
        }

1855
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1856
        public async Task Method_OptionalParameter()
1857
        {
1858 1859 1860 1861 1862 1863 1864 1865 1866
            await TestInClassAsync(
@"void M()
{
    Met$$hod();
}

void Method(int i = 0)
{
}",
1867 1868 1869
                MainDescription("void C.Method([int i = 0])"));
        }

1870
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1871
        public async Task Method_OptionalDecimalParameter()
1872
        {
1873
            await TestInClassAsync(
1874
@"void Goo(decimal x$$yz = 10)
1875 1876
{
}",
1877
                MainDescription($"({FeaturesResources.parameter}) decimal xyz = 10"));
1878 1879
        }

1880
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1881
        public async Task Method_Generic()
1882 1883 1884
        {
            // Generic method don't get the instantiation info yet.  NOTE: We don't display
            // constraint info in Dev10. Should we?
1885
            await TestInClassAsync(
1886
@"TOut Goo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>
1887
{
1888
    Go$$o<int, DateTime>(37);
1889 1890
}",

1891
            MainDescription("DateTime C.Goo<int, DateTime>(int arg)"));
1892 1893
        }

1894
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1895
        public async Task Method_UnconstructedGeneric()
1896
        {
1897
            await TestInClassAsync(
1898
@"TOut Goo<TIn, TOut>(TIn arg)
1899
{
1900
    Go$$o<TIn, TOut>(default(TIn);
1901 1902
}",

1903
                MainDescription("TOut C.Goo<TIn, TOut>(TIn arg)"));
1904 1905
        }

1906
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1907
        public async Task Method_Inferred()
1908
        {
1909
            await TestInClassAsync(
1910
@"void Goo<TIn>(TIn arg)
1911
{
1912
    Go$$o(42);
1913
}",
1914
                MainDescription("void C.Goo<int>(int arg)"));
1915 1916
        }

1917
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1918
        public async Task Method_MultipleParams()
1919
        {
1920
            await TestInClassAsync(
1921
@"void Goo(DateTime dt, System.IO.FileInfo fi, int number)
1922
{
1923
    Go$$o(DateTime.Now, null, 32);
1924
}",
1925
                MainDescription("void C.Goo(DateTime dt, System.IO.FileInfo fi, int number)"));
1926 1927
        }

1928
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1929
        public async Task Method_OptionalParam()
1930 1931
        {
            // NOTE - Default values aren't actually returned by symbols yet.
1932
            await TestInClassAsync(
1933
@"void Goo(int num = 42)
1934
{
1935
    Go$$o();
1936
}",
1937
                MainDescription("void C.Goo([int num = 42])"));
1938 1939
        }

1940
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1941
        public async Task Method_ParameterModifiers()
1942 1943
        {
            // NOTE - Default values aren't actually returned by symbols yet.
1944
            await TestInClassAsync(
1945
@"void Goo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers)
1946
{
1947
    Go$$o(DateTime.Now, null, 32);
1948
}",
1949
                MainDescription("void C.Goo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers)"));
1950 1951
        }

1952
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1953
        public async Task Constructor()
1954
        {
1955 1956 1957 1958 1959 1960 1961 1962 1963
            await TestInClassAsync(
@"public C()
{
}

void M()
{
    new C$$().ToString();
}",
1964 1965 1966
                MainDescription("C.C()"));
        }

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

public C(DateTime dt)
{
}

public C(int i)
{
}
1982 1983 1984

void M()
{
1985
    new C$$(DateTime.MaxValue).ToString();
1986
}",
1987
                MainDescription($"C.C(DateTime dt) (+ 2 {FeaturesResources.overloads_})"));
1988 1989 1990 1991 1992
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
1993
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1994
        public async Task Constructor_OverloadFromStringLiteral()
1995
        {
1996 1997
            await TestInMethodAsync(
@"new InvalidOperatio$$nException("""");",
1998
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})"));
1999 2000 2001 2002 2003
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
2004
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2005
        public async Task Constructor_UnknownType()
2006
        {
2007 2008 2009
            await TestInvalidTypeInClassAsync(
@"void M()
{
2010
    new G$$oo();
2011
}");
2012 2013 2014 2015 2016
        }

        /// <summary>
        /// Regression for 3923
        /// </summary>
2017
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2018
        public async Task Constructor_OverloadFromProperty()
2019
        {
2020 2021
            await TestInMethodAsync(
@"new InvalidOperatio$$nException(this.GetType().Name);",
2022
                MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})"));
2023 2024
        }

2025
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2026
        public async Task Constructor_Metadata()
2027
        {
2028 2029
            await TestInMethodAsync(
@"new Argument$$NullException();",
2030
                MainDescription($"ArgumentNullException.ArgumentNullException() (+ 3 {FeaturesResources.overloads_})"));
2031 2032
        }

2033
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2034
        public async Task Constructor_MetadataQualified()
2035
        {
C
Cyrus Najmabadi 已提交
2036
            await TestInMethodAsync(@"new System.IO.File$$Info(null);",
2037 2038 2039
                MainDescription("System.IO.FileInfo.FileInfo(string fileName)"));
        }

2040
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2041
        public async Task InterfaceProperty()
2042
        {
2043 2044
            await TestInMethodAsync(
@"interface I
2045 2046 2047 2048 2049 2050
{
    string Name$$ { get; set; }
}",
                MainDescription("string I.Name { get; set; }"));
        }

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

class C : I
{
    string IEmployee.Name$$
    {
2064 2065 2066 2067 2068 2069 2070 2071
        get
        {
            return """";
        }

        set
        {
        }
2072 2073 2074 2075 2076
    }
}",
                MainDescription("string C.Name { get; set; }"));
        }

2077
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2078
        public async Task Operator()
2079
        {
2080 2081 2082 2083 2084 2085 2086 2087 2088 2089
            await TestInClassAsync(
@"public static C operator +(C left, C right)
{
    return null;
}

void M(C left, C right)
{
    return left +$$ right;
}",
2090 2091 2092
                MainDescription("C C.operator +(C left, C right)"));
        }

2093
#pragma warning disable CA2243 // Attribute string literals should parse correctly
2094
        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
2095
#pragma warning restore CA2243 // Attribute string literals should parse correctly
2096
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2097
        public async Task GenericMethodWithConstraintsAtDeclaration()
2098
        {
2099
            await TestInClassAsync(
2100
@"TOut G$$oo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>
2101
{
2102 2103
}",

2104
            MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>"));
2105 2106
        }

2107
#pragma warning disable CA2243 // Attribute string literals should parse correctly
2108
        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
2109
#pragma warning restore CA2243 // Attribute string literals should parse correctly
2110
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2111
        public async Task GenericMethodWithMultipleConstraintsAtDeclaration()
2112
        {
2113
            await TestInClassAsync(
2114
@"TOut Goo<TIn, TOut>(TIn arg) where TIn : Employee, new()
2115
{
2116
    Go$$o<TIn, TOut>(default(TIn);
2117
}",
2118

2119
            MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : Employee, new()"));
2120 2121
        }

2122
#pragma warning disable CA2243 // Attribute string literals should parse correctly
2123
        [WorkItem(792629, "generic type parameter constraints for methods in quick info")]
2124
#pragma warning restore CA2243 // Attribute string literals should parse correctly
2125
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2126
        public async Task UnConstructedGenericMethodWithConstraintsAtInvocation()
2127
        {
2128
            await TestInClassAsync(
2129
@"TOut Goo<TIn, TOut>(TIn arg) where TIn : Employee
2130
{
2131
    Go$$o<TIn, TOut>(default(TIn);
2132
}",
2133

2134
            MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : Employee"));
2135 2136
        }

2137
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2138
        public async Task GenericTypeWithConstraintsAtDeclaration()
2139
        {
C
CyrusNajmabadi 已提交
2140 2141
            await TestAsync(
@"public class Employee : IComparable<Employee>
2142 2143 2144 2145 2146 2147
{
    public int CompareTo(Employee other)
    {
        throw new NotImplementedException();
    }
}
C
CyrusNajmabadi 已提交
2148

2149 2150 2151 2152 2153 2154 2155
class Emplo$$yeeList<T> : IEnumerable<T> where T : Employee, System.IComparable<T>, new()
{
}",

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

2156
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2157
        public async Task GenericType()
2158
        {
C
CyrusNajmabadi 已提交
2159 2160
            await TestAsync(
@"class T1<T11>
2161 2162
{
    $$T11 i;
C
CyrusNajmabadi 已提交
2163
}",
2164
                MainDescription($"T11 {FeaturesResources.in_} T1<T11>"));
2165 2166
        }

2167
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2168
        public async Task GenericMethod()
2169
        {
2170 2171 2172 2173 2174
            await TestInClassAsync(
@"static void Meth1<T1>(T1 i) where T1 : struct
{
    $$T1 i;
}",
2175
                MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct"));
2176 2177
        }

2178
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2179
        public async Task Var()
2180
        {
2181 2182 2183
            await TestInMethodAsync(
@"var x = new Exception();
var y = $$x;",
2184
                MainDescription($"({FeaturesResources.local_variable}) Exception x"));
2185 2186
        }

2187
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2188
        public async Task NestedInGeneric()
2189
        {
2190 2191
            await TestInMethodAsync(
@"List<int>.Enu$$merator e;",
2192
                MainDescription("struct System.Collections.Generic.List<T>.Enumerator"),
2193
                TypeParameterMap($"\r\nT {FeaturesResources.is_} int"));
2194 2195
        }

2196
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2197
        public async Task NestedGenericInGeneric()
2198
        {
C
CyrusNajmabadi 已提交
2199 2200
            await TestAsync(
@"class Outer<T>
2201 2202 2203 2204 2205 2206 2207 2208 2209
{
    class Inner<U>
    {
    }

    static void M()
    {
        Outer<int>.I$$nner<string> e;
    }
C
CyrusNajmabadi 已提交
2210
}",
2211 2212
                MainDescription("class Outer<T>.Inner<U>"),
                TypeParameterMap(
2213 2214
                    Lines($"\r\nT {FeaturesResources.is_} int",
                          $"U {FeaturesResources.is_} string")));
2215 2216
        }

2217
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2218
        public async Task ObjectInitializer1()
2219
        {
2220 2221 2222 2223 2224
            await TestInClassAsync(
@"void M()
{
    var x = new test() { $$z = 5 };
}
2225

2226 2227 2228 2229
class test
{
    public int z;
}",
2230
                MainDescription($"({FeaturesResources.field}) int test.z"));
2231 2232
        }

2233
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2234
        public async Task ObjectInitializer2()
2235
        {
2236 2237
            await TestInMethodAsync(
@"class C
2238 2239 2240 2241 2242 2243 2244 2245 2246 2247
{
    void M()
    {
        var x = new test() { z = $$5 };
    }

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

2252
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
2253
        [WorkItem(537880, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537880")]
C
Cyrus Najmabadi 已提交
2254
        public async Task TypeArgument()
2255
        {
C
CyrusNajmabadi 已提交
2256 2257
            await TestAsync(
@"class C<T, Y>
2258 2259 2260 2261 2262 2263 2264
{
    void M()
    {
        C<int, DateTime> variable;
        $$variable = new C<int, DateTime>();
    }
}",
2265
                MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable"));
2266 2267
        }

2268
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2269
        public async Task ForEachLoop_1()
2270
        {
2271 2272 2273
            await TestInMethodAsync(
@"int bb = 555;

2274 2275 2276 2277
bb = bb + 1;
foreach (int cc in new int[]{ 1,2,3}){
c$$c = 1;
bb = bb + 21;
2278
}",
2279
                MainDescription($"({FeaturesResources.local_variable}) int cc"));
2280 2281
        }

2282
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2283
        public async Task TryCatchFinally_1()
2284
        {
2285 2286
            await TestInMethodAsync(
@"try
2287 2288
            {
                int aa = 555;
2289 2290

a$$a = aa + 1;
2291 2292 2293 2294 2295 2296 2297
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }",
2298
                MainDescription($"({FeaturesResources.local_variable}) int aa"));
2299 2300
        }

2301
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2302
        public async Task TryCatchFinally_2()
2303
        {
2304 2305
            await TestInMethodAsync(
@"try
2306 2307 2308 2309 2310
            {
            }
            catch (Exception ex)
            {
                var y = e$$x;
2311
var z = y;
2312 2313 2314
            }
            finally
            {
2315
            }",
2316
                MainDescription($"({FeaturesResources.local_variable}) Exception ex"));
2317 2318
        }

2319
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2320
        public async Task TryCatchFinally_3()
2321
        {
2322 2323
            await TestInMethodAsync(
@"try
2324 2325 2326 2327 2328
            {
            }
            catch (Exception ex)
            {
                var aa = 555;
2329 2330

aa = a$$a + 1;
2331 2332 2333
            }
            finally
            {
2334
            }",
2335
                MainDescription($"({FeaturesResources.local_variable}) int aa"));
2336 2337
        }

2338
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2339
        public async Task TryCatchFinally_4()
2340
        {
2341 2342
            await TestInMethodAsync(
@"try
2343 2344 2345 2346 2347 2348 2349 2350
            {
            }
            catch (Exception ex)
            {
            }
            finally
            {
                int aa = 555;
2351 2352 2353

aa = a$$a + 1;
            }",
2354
                MainDescription($"({FeaturesResources.local_variable}) int aa"));
2355 2356
        }

2357
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2358
        public async Task GenericVariable()
2359
        {
C
CyrusNajmabadi 已提交
2360 2361 2362 2363 2364 2365 2366 2367 2368
            await TestAsync(
@"class C<T, Y>
{
    void M()
    {
        C<int, DateTime> variable;
        var$$iable = new C<int, DateTime>();
    }
}",
2369
                MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable"));
2370 2371
        }

2372
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2373
        public async Task TestInstantiation()
2374
        {
C
CyrusNajmabadi 已提交
2375 2376 2377
            await TestAsync(
@"using System.Collections.Generic;

2378 2379 2380 2381 2382 2383 2384
class Program<T>
{
    static void Main(string[] args)
    {
        var p = new Dictio$$nary<int, string>();
    }
}",
2385
                MainDescription($"Dictionary<int, string>.Dictionary() (+ 5 {FeaturesResources.overloads_})"));
2386 2387
        }

2388
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2389
        public async Task TestUsingAlias_Bug4141()
2390
        {
C
CyrusNajmabadi 已提交
2391 2392 2393 2394 2395 2396 2397 2398
            await TestAsync(
@"using X = A.C;

class A
{
    public class C
    {
    }
2399
}
C
CyrusNajmabadi 已提交
2400 2401 2402 2403

class D : X$$
{
}",
2404 2405 2406
                MainDescription(@"class A.C"));
        }

2407
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2408
        public async Task TestFieldOnDeclaration()
2409
        {
2410 2411
            await TestInClassAsync(
@"DateTime fie$$ld;",
2412
                MainDescription($"({FeaturesResources.field}) DateTime C.field"));
2413 2414
        }

J
Jared Parsons 已提交
2415
        [WorkItem(538767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538767")]
2416
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2417
        public async Task TestGenericErrorFieldOnDeclaration()
2418
        {
2419 2420
            await TestInClassAsync(
@"NonExistentType<int> fi$$eld;",
2421
                MainDescription($"({FeaturesResources.field}) NonExistentType<int> C.field"));
2422 2423
        }

J
Jared Parsons 已提交
2424
        [WorkItem(538822, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538822")]
2425
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2426
        public async Task TestDelegateType()
2427
        {
2428 2429
            await TestInClassAsync(
@"Fun$$c<int, string> field;",
2430 2431
                MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"),
                TypeParameterMap(
2432 2433
                    Lines($"\r\nT {FeaturesResources.is_} int",
                          $"TResult {FeaturesResources.is_} string")));
2434 2435
        }

J
Jared Parsons 已提交
2436
        [WorkItem(538824, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538824")]
2437
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2438
        public async Task TestOnDelegateInvocation()
2439
        {
C
CyrusNajmabadi 已提交
2440 2441
            await TestAsync(
@"class Program
2442 2443
{
    delegate void D1();
C
CyrusNajmabadi 已提交
2444

2445 2446 2447
    static void Main()
    {
        D1 d = Main;
C
CyrusNajmabadi 已提交
2448
        $$d();
2449
    }
C
CyrusNajmabadi 已提交
2450
}",
2451
                MainDescription($"({FeaturesResources.local_variable}) D1 d"));
2452 2453
        }

J
Jared Parsons 已提交
2454
        [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")]
2455
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2456
        public async Task TestOnArrayCreation1()
2457
        {
C
CyrusNajmabadi 已提交
2458 2459
            await TestAsync(
@"class Program
2460 2461 2462 2463 2464
{
    static void Main()
    {
        int[] a = n$$ew int[0];
    }
2465
}", MainDescription("int[]"));
2466 2467
        }

J
Jared Parsons 已提交
2468
        [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")]
2469
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2470
        public async Task TestOnArrayCreation2()
2471
        {
C
CyrusNajmabadi 已提交
2472 2473
            await TestAsync(
@"class Program
2474 2475 2476 2477 2478 2479 2480 2481 2482
{
    static void Main()
    {
        int[] a = new i$$nt[0];
    }
}",
                MainDescription("struct System.Int32"));
        }

J
Jared Parsons 已提交
2483
        [WorkItem(539841, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539841")]
2484
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2485
        public async Task TestIsNamedTypeAccessibleForErrorTypes()
2486
        {
C
CyrusNajmabadi 已提交
2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497
            await TestAsync(
@"sealed class B<T1, T2> : A<B<T1, T2>>
{
    protected sealed override B<A<T>, A$$<T>> N()
    {
    }
}

internal class A<T>
{
}",
2498 2499 2500
                MainDescription("class A<T>"));
        }

J
Jared Parsons 已提交
2501
        [WorkItem(540075, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540075")]
2502
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2503
        public async Task TestErrorType()
2504
        {
C
CyrusNajmabadi 已提交
2505
            await TestAsync(
2506
@"using Goo = Goo;
C
CyrusNajmabadi 已提交
2507

2508 2509 2510 2511
class C
{
    void Main()
    {
2512
        $$Goo
2513 2514
    }
}",
2515
                MainDescription("Goo"));
2516 2517
        }

2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 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
        [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 已提交
2611
        [WorkItem(540871, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540871")]
2612
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2613
        public async Task TestLiterals()
2614
        {
C
CyrusNajmabadi 已提交
2615 2616
            await TestAsync(
@"class MyClass
2617
{
C
CyrusNajmabadi 已提交
2618
    MyClass() : this($$10)
2619 2620 2621
    {
        intI = 2;
    }
C
CyrusNajmabadi 已提交
2622 2623 2624 2625 2626

    public MyClass(int i)
    {
    }

2627
    static int intI = 1;
C
CyrusNajmabadi 已提交
2628

2629 2630 2631 2632 2633 2634 2635 2636
    public static int Main()
    {
        return 1;
    }
}",
                MainDescription("struct System.Int32"));
        }

J
Jared Parsons 已提交
2637
        [WorkItem(541444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541444")]
2638
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2639
        public async Task TestErrorInForeach()
2640
        {
C
CyrusNajmabadi 已提交
2641 2642
            await TestAsync(
@"class C
2643 2644 2645 2646 2647 2648 2649 2650 2651
{
    void Main()
    {
        foreach (int cc in null)
        {
            $$cc = 1;
        }
    }
}",
2652
                MainDescription($"({FeaturesResources.local_variable}) int cc"));
2653 2654
        }

J
Jared Parsons 已提交
2655
        [WorkItem(540438, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540438")]
2656
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2657
        public async Task TestNoQuickInfoOnAnonymousDelegate()
2658
        {
C
CyrusNajmabadi 已提交
2659 2660
            await TestAsync(
@"using System;
2661 2662 2663 2664 2665

class Program
{
    static void Main(string[] args)
    {
2666
        Action a = $$delegate {
C
CyrusNajmabadi 已提交
2667
        };
2668 2669 2670 2671
    }
}");
        }

J
Jared Parsons 已提交
2672
        [WorkItem(541678, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541678")]
2673
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2674
        public async Task TestQuickInfoOnEvent()
2675
        {
C
CyrusNajmabadi 已提交
2676 2677 2678
            await TestAsync(
@"using System;

2679 2680
public class SampleEventArgs
{
C
CyrusNajmabadi 已提交
2681 2682 2683 2684 2685 2686
    public SampleEventArgs(string s)
    {
        Text = s;
    }

    public String Text { get; private set; }
2687
}
C
CyrusNajmabadi 已提交
2688

2689 2690 2691
public class Publisher
{
    public delegate void SampleEventHandler(object sender, SampleEventArgs e);
C
CyrusNajmabadi 已提交
2692

2693
    public event SampleEventHandler SampleEvent;
C
CyrusNajmabadi 已提交
2694

2695 2696 2697 2698 2699
    protected virtual void RaiseSampleEvent()
    {
        if (Sam$$pleEvent != null)
            SampleEvent(this, new SampleEventArgs(""Hello""));
    }
C
CyrusNajmabadi 已提交
2700
}",
2701 2702 2703
                MainDescription("SampleEventHandler Publisher.SampleEvent"));
        }

J
Jared Parsons 已提交
2704
        [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")]
2705
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2706
        public async Task TestEvent()
2707
        {
C
Cyrus Najmabadi 已提交
2708
            await TestInMethodAsync(@"System.Console.CancelKeyPres$$s += null;",
2709 2710 2711
                MainDescription("ConsoleCancelEventHandler Console.CancelKeyPress"));
        }

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

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

J
Jared Parsons 已提交
2728
        [WorkItem(541885, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541885")]
2729
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2730
        public async Task TestQuickInfoOnExtensionMethod()
2731
        {
2732 2733
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2734 2735
using System.Collections.Generic;
using System.Linq;
2736

2737 2738 2739 2740
class Program
{
    static void Main(string[] args)
    {
2741 2742 2743
        int[] values = {
            1
        };
2744 2745 2746
        bool isArray = 7.I$$n(values);
    }
}
2747

2748 2749 2750 2751 2752 2753
public static class MyExtensions
{
    public static bool In<T>(this T o, IEnumerable<T> items)
    {
        return true;
    }
2754
}",
2755
                MainDescription($"({CSharpFeaturesResources.extension}) bool int.In<int>(IEnumerable<int> items)"));
2756 2757
        }

2758
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2759
        public async Task TestQuickInfoOnExtensionMethodOverloads()
2760
        {
2761 2762
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2763 2764 2765 2766 2767 2768
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
2769
        ""1"".Test$$Ext();
2770 2771
    }
}
2772

2773 2774
public static class Ex
{
2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786
    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)
    {
    }
}",
2787
                MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 2 {FeaturesResources.overloads_})"));
2788 2789
        }

2790
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2791
        public async Task TestQuickInfoOnExtensionMethodOverloads2()
2792
        {
2793 2794
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2795 2796 2797 2798 2799 2800
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
2801
        ""1"".Test$$Ext();
2802 2803
    }
}
2804

2805 2806
public static class Ex
{
2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818
    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)
    {
    }
}",
2819
                MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 1 {FeaturesResources.overload})"));
2820 2821
        }

2822
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2823
        public async Task Query1()
2824
        {
C
CyrusNajmabadi 已提交
2825 2826 2827
            await TestAsync(
@"using System.Linq;

2828 2829 2830 2831
class C
{
    void M()
    {
C
CyrusNajmabadi 已提交
2832 2833
        var q = from n in new int[] { 1, 2, 3, 4, 5 }

2834 2835
                select $$n;
    }
C
CyrusNajmabadi 已提交
2836
}",
2837
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2838 2839
        }

2840
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2841
        public async Task Query2()
2842
        {
C
CyrusNajmabadi 已提交
2843 2844 2845
            await TestAsync(
@"using System.Linq;

2846 2847 2848 2849
class C
{
    void M()
    {
C
CyrusNajmabadi 已提交
2850 2851
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5 }

2852 2853
                select n;
    }
C
CyrusNajmabadi 已提交
2854
}",
2855
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2856 2857
        }

2858
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2859
        public async Task Query3()
2860
        {
C
CyrusNajmabadi 已提交
2861 2862
            await TestAsync(
@"class C
2863 2864 2865
{
    void M()
    {
C
CyrusNajmabadi 已提交
2866 2867
        var q = from n in new int[] { 1, 2, 3, 4, 5 }

2868 2869
                select $$n;
    }
C
CyrusNajmabadi 已提交
2870
}",
2871
                MainDescription($"({FeaturesResources.range_variable}) ? n"));
2872 2873
        }

2874
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2875
        public async Task Query4()
2876
        {
C
CyrusNajmabadi 已提交
2877 2878
            await TestAsync(
@"class C
2879 2880 2881
{
    void M()
    {
C
CyrusNajmabadi 已提交
2882 2883
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5 }

2884 2885
                select n;
    }
C
CyrusNajmabadi 已提交
2886
}",
2887
                MainDescription($"({FeaturesResources.range_variable}) ? n"));
2888 2889
        }

2890
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2891
        public async Task Query5()
2892
        {
C
CyrusNajmabadi 已提交
2893 2894
            await TestAsync(
@"using System.Collections.Generic;
2895
using System.Linq;
C
CyrusNajmabadi 已提交
2896

2897 2898 2899 2900 2901 2902 2903
class C
{
    void M()
    {
        var q = from n in new List<object>()
                select $$n;
    }
C
CyrusNajmabadi 已提交
2904
}",
2905
                MainDescription($"({FeaturesResources.range_variable}) object n"));
2906 2907
        }

2908
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2909
        public async Task Query6()
2910
        {
C
CyrusNajmabadi 已提交
2911 2912
            await TestAsync(
@"using System.Collections.Generic;
2913
using System.Linq;
C
CyrusNajmabadi 已提交
2914

2915 2916 2917 2918 2919 2920 2921
class C
{
    void M()
    {
        var q = from n$$ in new List<object>()
                select n;
    }
C
CyrusNajmabadi 已提交
2922
}",
2923
                MainDescription($"({FeaturesResources.range_variable}) object n"));
2924 2925
        }

2926
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2927
        public async Task Query7()
2928
        {
C
CyrusNajmabadi 已提交
2929 2930
            await TestAsync(
@"using System.Collections.Generic;
2931
using System.Linq;
C
CyrusNajmabadi 已提交
2932

2933 2934 2935 2936 2937 2938 2939
class C
{
    void M()
    {
        var q = from int n in new List<object>()
                select $$n;
    }
C
CyrusNajmabadi 已提交
2940
}",
2941
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2942 2943
        }

2944
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2945
        public async Task Query8()
2946
        {
C
CyrusNajmabadi 已提交
2947 2948
            await TestAsync(
@"using System.Collections.Generic;
2949
using System.Linq;
C
CyrusNajmabadi 已提交
2950

2951 2952 2953 2954 2955 2956 2957
class C
{
    void M()
    {
        var q = from int n$$ in new List<object>()
                select n;
    }
C
CyrusNajmabadi 已提交
2958
}",
2959
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2960 2961
        }

2962
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2963
        public async Task Query9()
2964
        {
C
CyrusNajmabadi 已提交
2965 2966
            await TestAsync(
@"using System.Collections.Generic;
2967
using System.Linq;
C
CyrusNajmabadi 已提交
2968

2969 2970 2971 2972 2973 2974 2975 2976
class C
{
    void M()
    {
        var q = from x$$ in new List<List<int>>()
                from y in x
                select y;
    }
C
CyrusNajmabadi 已提交
2977
}",
2978
                MainDescription($"({FeaturesResources.range_variable}) List<int> x"));
2979 2980
        }

2981
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2982
        public async Task Query10()
2983
        {
C
CyrusNajmabadi 已提交
2984 2985
            await TestAsync(
@"using System.Collections.Generic;
2986
using System.Linq;
C
CyrusNajmabadi 已提交
2987

2988 2989 2990 2991 2992 2993 2994 2995
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y in $$x
                select y;
    }
C
CyrusNajmabadi 已提交
2996
}",
2997
                MainDescription($"({FeaturesResources.range_variable}) List<int> x"));
2998 2999
        }

3000
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3001
        public async Task Query11()
3002
        {
C
CyrusNajmabadi 已提交
3003 3004
            await TestAsync(
@"using System.Collections.Generic;
3005
using System.Linq;
C
CyrusNajmabadi 已提交
3006

3007 3008 3009 3010 3011 3012 3013 3014
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y$$ in x
                select y;
    }
C
CyrusNajmabadi 已提交
3015
}",
3016
                MainDescription($"({FeaturesResources.range_variable}) int y"));
3017 3018
        }

3019
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3020
        public async Task Query12()
3021
        {
C
CyrusNajmabadi 已提交
3022 3023
            await TestAsync(
@"using System.Collections.Generic;
3024
using System.Linq;
C
CyrusNajmabadi 已提交
3025

3026 3027 3028 3029 3030 3031 3032 3033
class C
{
    void M()
    {
        var q = from x in new List<List<int>>()
                from y in x
                select $$y;
    }
C
CyrusNajmabadi 已提交
3034
}",
3035
                MainDescription($"({FeaturesResources.range_variable}) int y"));
3036 3037
        }

J
Jared Parsons 已提交
3038
        [WorkItem(543205, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543205")]
3039
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3040
        public async Task TestErrorGlobal()
3041
        {
C
CyrusNajmabadi 已提交
3042 3043 3044
            await TestAsync(
@"extern alias global;

3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055
class myClass
{
    static int Main()
    {
        $$global::otherClass oc = new global::otherClass();
        return 0;
    }
}",
                MainDescription("<global namespace>"));
        }

3056
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3057
        public async Task DontRemoveAttributeSuffixAndProduceInvalidIdentifier1()
3058
        {
C
CyrusNajmabadi 已提交
3059 3060 3061
            await TestAsync(
@"using System;

3062 3063 3064 3065
class classAttribute : Attribute
{
    private classAttribute x$$;
}",
3066
                MainDescription($"({FeaturesResources.field}) classAttribute classAttribute.x"));
3067 3068
        }

J
Jared Parsons 已提交
3069
        [WorkItem(544026, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544026")]
3070
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3071
        public async Task DontRemoveAttributeSuffix2()
3072
        {
C
CyrusNajmabadi 已提交
3073 3074 3075
            await TestAsync(
@"using System;

3076 3077 3078 3079
class class1Attribute : Attribute
{
    private class1Attribute x$$;
}",
3080
                MainDescription($"({FeaturesResources.field}) class1Attribute class1Attribute.x"));
3081 3082
        }

3083
        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
3084
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3085
        public async Task AttributeQuickInfoBindsToClassTest()
3086
        {
C
CyrusNajmabadi 已提交
3087 3088
            await TestAsync(
@"using System;
3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101

/// <summary>
/// class comment
/// </summary>
[Some$$]
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
    }
C
CyrusNajmabadi 已提交
3102
}",
3103 3104 3105 3106
                Documentation("class comment"));
        }

        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
3107
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3108
        public async Task AttributeConstructorQuickInfo()
3109
        {
C
CyrusNajmabadi 已提交
3110 3111
            await TestAsync(
@"using System;
3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124

/// <summary>
/// class comment
/// </summary>
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
        var s = new Some$$Attribute();
    }
C
CyrusNajmabadi 已提交
3125
}",
3126 3127 3128
                Documentation("ctor comment"));
        }

3129
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3130
        public async Task TestLabel()
3131
        {
3132 3133 3134
            await TestInClassAsync(
@"void M()
{
3135 3136 3137
Goo:
    int Goo;
    goto Goo$$;
3138
}",
3139
                MainDescription($"({FeaturesResources.label}) Goo"));
3140 3141
        }

J
Jared Parsons 已提交
3142
        [WorkItem(542613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542613")]
3143
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3144
        public async Task TestUnboundGeneric()
3145
        {
C
CyrusNajmabadi 已提交
3146 3147
            await TestAsync(
@"using System;
3148
using System.Collections.Generic;
C
CyrusNajmabadi 已提交
3149

3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160
class C
{
    void M()
    {
        Type t = typeof(L$$ist<>);
    }
}",
                MainDescription("class System.Collections.Generic.List<T>"),
                NoTypeParameterMap);
        }

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

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

x[0].$$Address",
3191 3192 3193
                MainDescription(@"'b 'a.Address { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3194
$@"
3195 3196 3197
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ string Name, 'b Address }}
    'b {FeaturesResources.is_} new {{ string Street, string Zip }}"));
3198 3199

            // verify second property
3200 3201 3202 3203
            await TestInMethodAsync(
@"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } };

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

3213
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
3214
        [WorkItem(543183, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543183")]
C
Cyrus Najmabadi 已提交
3215
        public async Task TestAssignmentOperatorInAnonymousType()
3216
        {
C
CyrusNajmabadi 已提交
3217 3218
            await TestAsync(
@"class C
3219 3220 3221 3222 3223
{
    void M()
    {
        var a = new { A $$= 0 };
    }
C
CyrusNajmabadi 已提交
3224
}");
3225 3226
        }

3227
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3228
        [WorkItem(10731, "DevDiv_Projects/Roslyn")]
C
Cyrus Najmabadi 已提交
3229
        public async Task TestErrorAnonymousTypeDoesntShow()
3230
        {
3231 3232
            await TestInMethodAsync(
@"var a = new { new { N = 0 }.N, new { } }.$$N;",
3233 3234 3235
                MainDescription(@"int 'a.N { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3236
$@"
3237 3238
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ int N }}"));
3239 3240
        }

3241
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
3242
        [WorkItem(543553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543553")]
C
Cyrus Najmabadi 已提交
3243
        public async Task TestArrayAssignedToVar()
3244
        {
C
CyrusNajmabadi 已提交
3245 3246
            await TestAsync(
@"class C
3247 3248 3249 3250 3251
{
    static void M(string[] args)
    {
        v$$ar a = args;
    }
C
CyrusNajmabadi 已提交
3252
}",
3253 3254 3255
                MainDescription("string[]"));
        }

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

J
Jared Parsons 已提交
3281
        [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")]
3282
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3283
        public async Task QuickInfoOnOperator()
3284
        {
C
CyrusNajmabadi 已提交
3285 3286 3287
            await TestAsync(
@"using System.Collections.Generic;

3288 3289 3290 3291 3292 3293
class Program
{
    static void Main(string[] args)
    {
        var v = new Program() $$+ string.Empty;
    }
C
CyrusNajmabadi 已提交
3294

3295 3296 3297 3298
    public static implicit operator Program(string s)
    {
        return null;
    }
C
CyrusNajmabadi 已提交
3299

3300 3301 3302 3303 3304
    public static IEnumerable<Program> operator +(Program p1, Program p2)
    {
        yield return p1;
        yield return p2;
    }
C
CyrusNajmabadi 已提交
3305
}",
3306 3307 3308
                MainDescription("IEnumerable<Program> Program.operator +(Program p1, Program p2)"));
        }

3309
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3310
        public async Task TestConstantField()
3311
        {
C
CyrusNajmabadi 已提交
3312 3313 3314 3315
            await TestAsync(
@"class C
{
    const int $$F = 1;",
3316
                MainDescription($"({FeaturesResources.constant}) int C.F = 1"));
3317 3318
        }

3319
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3320
        public async Task TestMultipleConstantFields()
3321
        {
C
CyrusNajmabadi 已提交
3322 3323 3324 3325
            await TestAsync(
@"class C
{
    public const double X = 1.0, Y = 2.0, $$Z = 3.5;",
3326
                MainDescription($"({FeaturesResources.constant}) double C.Z = 3.5"));
3327 3328
        }

3329
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3330
        public async Task TestConstantDependencies()
3331
        {
C
CyrusNajmabadi 已提交
3332 3333
            await TestAsync(
@"class A
3334 3335 3336 3337
{
    public const int $$X = B.Z + 1;
    public const int Y = 10;
}
C
CyrusNajmabadi 已提交
3338

3339 3340 3341 3342
class B
{
    public const int Z = A.Y + 1;
}",
3343
                MainDescription($"({FeaturesResources.constant}) int A.X = B.Z + 1"));
3344 3345
        }

3346
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3347
        public async Task TestConstantCircularDependencies()
3348
        {
C
CyrusNajmabadi 已提交
3349 3350
            await TestAsync(
@"class A
3351 3352 3353
{
    public const int X = B.Z + 1;
}
C
CyrusNajmabadi 已提交
3354

3355 3356 3357 3358
class B
{
    public const int Z$$ = A.X + 1;
}",
3359
                MainDescription($"({FeaturesResources.constant}) int B.Z = A.X + 1"));
3360 3361
        }

J
Jared Parsons 已提交
3362
        [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")]
3363
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3364
        public async Task TestConstantOverflow()
3365
        {
C
CyrusNajmabadi 已提交
3366 3367
            await TestAsync(
@"class B
3368 3369 3370
{
    public const int Z$$ = int.MaxValue + 1;
}",
3371
                MainDescription($"({FeaturesResources.constant}) int B.Z = int.MaxValue + 1"));
3372 3373
        }

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

3386
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3387
        public async Task TestEnumInConstantField()
3388
        {
C
CyrusNajmabadi 已提交
3389 3390
            await TestAsync(
@"public class EnumTest
3391
{
C
CyrusNajmabadi 已提交
3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402
    enum Days
    {
        Sun,
        Mon,
        Tue,
        Wed,
        Thu,
        Fri,
        Sat
    };

3403 3404 3405 3406 3407
    static void Main()
    {
        const int $$x = (int)Days.Sun;
    }
}",
3408
                MainDescription($"({FeaturesResources.local_constant}) int x = (int)Days.Sun"));
3409 3410
        }

3411
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3412
        public async Task TestConstantInDefaultExpression()
3413
        {
C
CyrusNajmabadi 已提交
3414 3415
            await TestAsync(
@"public class EnumTest
3416
{
C
CyrusNajmabadi 已提交
3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427
    enum Days
    {
        Sun,
        Mon,
        Tue,
        Wed,
        Thu,
        Fri,
        Sat
    };

3428 3429 3430 3431 3432
    static void Main()
    {
        const Days $$x = default(Days);
    }
}",
3433
                MainDescription($"({FeaturesResources.local_constant}) Days x = default(Days)"));
3434 3435
        }

3436
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3437
        public async Task TestConstantParameter()
3438
        {
C
CyrusNajmabadi 已提交
3439 3440 3441 3442 3443
            await TestAsync(
@"class C
{
    void Bar(int $$b = 1);
}",
3444
                MainDescription($"({FeaturesResources.parameter}) int b = 1"));
3445 3446
        }

3447
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3448
        public async Task TestConstantLocal()
3449
        {
C
CyrusNajmabadi 已提交
3450 3451 3452 3453 3454 3455 3456
            await TestAsync(
@"class C
{
    void Bar()
    {
        const int $$loc = 1;
    }",
3457
                MainDescription($"({FeaturesResources.local_constant}) int loc = 1"));
3458 3459
        }

J
Jared Parsons 已提交
3460
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3461
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3462
        public async Task TestErrorType1()
3463
        {
3464
            await TestInMethodAsync(
3465 3466
@"var $$v1 = new Goo();",
                MainDescription($"({FeaturesResources.local_variable}) Goo v1"));
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 TestErrorType2()
3472
        {
3473 3474
            await TestInMethodAsync(
@"var $$v1 = v1;",
3475
                MainDescription($"({FeaturesResources.local_variable}) var 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 TestErrorType3()
3481
        {
3482
            await TestInMethodAsync(
3483 3484
@"var $$v1 = new Goo<Bar>();",
                MainDescription($"({FeaturesResources.local_variable}) Goo<Bar> 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 TestErrorType4()
3490
        {
3491 3492
            await TestInMethodAsync(
@"var $$v1 = &(x => x);",
3493
                MainDescription($"({FeaturesResources.local_variable}) ?* 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 TestErrorType5()
3499
        {
C
Cyrus Najmabadi 已提交
3500
            await TestInMethodAsync("var $$v1 = &v1",
3501
                MainDescription($"({FeaturesResources.local_variable}) var* v1"));
3502 3503
        }

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

J
Jared Parsons 已提交
3512
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3513
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3514
        public async Task TestErrorType7()
3515
        {
3516 3517 3518 3519 3520 3521 3522
            await TestInClassAsync(
@"class C
{
    void Method()
    {
    }

3523
    void Goo()
3524 3525 3526 3527
    {
        var $$v1 = MethodGroup;
    }
}",
3528
                MainDescription($"({FeaturesResources.local_variable}) ? v1"));
3529 3530
        }

J
Jared Parsons 已提交
3531
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3532
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3533
        public async Task TestErrorType8()
3534
        {
C
Cyrus Najmabadi 已提交
3535
            await TestInMethodAsync("var $$v1 = Unknown",
3536
                MainDescription($"({FeaturesResources.local_variable}) ? v1"));
3537 3538
        }

J
Jared Parsons 已提交
3539
        [WorkItem(545072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545072")]
3540
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3541
        public async Task TestDelegateSpecialTypes()
3542
        {
C
CyrusNajmabadi 已提交
3543 3544
            await TestAsync(
@"delegate void $$F(int x);",
3545 3546 3547
                MainDescription("delegate void F(int x)"));
        }

J
Jared Parsons 已提交
3548
        [WorkItem(545108, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545108")]
3549
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3550
        public async Task TestNullPointerParameter()
3551
        {
C
CyrusNajmabadi 已提交
3552 3553 3554
            await TestAsync(
@"class C
{
3555
    unsafe void $$Goo(int* x = null)
C
CyrusNajmabadi 已提交
3556 3557 3558
    {
    }
}",
3559
                MainDescription("void C.Goo([int* x = null])"));
3560 3561
        }

J
Jared Parsons 已提交
3562
        [WorkItem(545098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545098")]
3563
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3564
        public async Task TestLetIdentifier1()
3565
        {
C
Cyrus Najmabadi 已提交
3566
            await TestInMethodAsync("var q = from e in \"\" let $$y = 1 let a = new { y } select a;",
3567
                MainDescription($"({FeaturesResources.range_variable}) int y"));
3568 3569
        }

J
Jared Parsons 已提交
3570
        [WorkItem(545295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545295")]
3571
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3572
        public async Task TestNullableDefaultValue()
3573
        {
C
CyrusNajmabadi 已提交
3574 3575 3576 3577 3578 3579 3580
            await TestAsync(
@"class Test
{
    void $$Method(int? t1 = null)
    {
    }
}",
3581 3582 3583
                MainDescription("void Test.Method([int? t1 = null])"));
        }

J
Jared Parsons 已提交
3584
        [WorkItem(529586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529586")]
3585
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3586
        public async Task TestInvalidParameterInitializer()
3587
        {
C
Cyrus Najmabadi 已提交
3588
            await TestAsync(
C
CyrusNajmabadi 已提交
3589 3590 3591 3592 3593 3594 3595 3596
@"class Program
{
    void M1(float $$j1 = ""Hello""
+
""World"")
    {
    }
}",
3597
                MainDescription($@"({FeaturesResources.parameter}) float j1 = ""Hello"" + ""World"""));
3598 3599
        }

J
Jared Parsons 已提交
3600
        [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")]
3601
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3602
        public async Task TestComplexConstLocal()
3603
        {
C
Cyrus Najmabadi 已提交
3604
            await TestAsync(
3605 3606 3607 3608 3609 3610 3611 3612
@"class Program
{
    void Main()
    {
        const int MEGABYTE = 1024 *
            1024 + true;
        Blah($$MEGABYTE);
    }
C
CyrusNajmabadi 已提交
3613
}",
3614
                MainDescription($@"({FeaturesResources.local_constant}) int MEGABYTE = 1024 * 1024 + true"));
3615 3616
        }

J
Jared Parsons 已提交
3617
        [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")]
3618
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3619
        public async Task TestComplexConstField()
3620
        {
C
Cyrus Najmabadi 已提交
3621
            await TestAsync(
3622 3623
@"class Program
{
C
CyrusNajmabadi 已提交
3624 3625
    const int a = true
        -
3626
        false;
C
CyrusNajmabadi 已提交
3627

3628 3629
    void Main()
    {
3630
        Goo($$a);
3631 3632
    }
}",
3633
                MainDescription($"({FeaturesResources.constant}) int Program.a = true - false"));
3634 3635
        }

3636
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3637
        public async Task TestTypeParameterCrefDoesNotHaveQuickInfo()
3638
        {
C
Cyrus Najmabadi 已提交
3639
            await TestAsync(
3640 3641 3642 3643 3644 3645 3646 3647 3648
@"class C<T>
{
    ///  <see cref=""C{X$$}""/>
    static void Main(string[] args)
    {
    }
}");
        }

3649
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3650
        public async Task TestCref1()
3651
        {
C
Cyrus Najmabadi 已提交
3652
            await TestAsync(
3653 3654 3655 3656 3657 3658 3659 3660 3661 3662
@"class Program
{
    ///  <see cref=""Mai$$n""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

3663
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3664
        public async Task TestCref2()
3665
        {
C
Cyrus Najmabadi 已提交
3666
            await TestAsync(
3667 3668 3669 3670 3671 3672 3673 3674 3675 3676
@"class Program
{
    ///  <see cref=""$$Main""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

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

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

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

J
Jared Parsons 已提交
3716
        [WorkItem(546849, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546849")]
3717
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3718
        public async Task TestIndexedProperty()
3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755
        {
            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 已提交
3756
            await TestWithReferenceAsync(sourceCode: markup,
3757 3758 3759 3760 3761 3762
                referencedCode: referencedCode,
                sourceLanguage: LanguageNames.CSharp,
                referencedLanguage: LanguageNames.VisualBasic,
                expectedResults: MainDescription("string CCC.IndexProp[int p1, [int p2 = 0]] { get; set; }"));
        }

J
Jared Parsons 已提交
3763
        [WorkItem(546918, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546918")]
3764
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3765
        public async Task TestUnconstructedGeneric()
3766
        {
C
Cyrus Najmabadi 已提交
3767
            await TestAsync(
C
CyrusNajmabadi 已提交
3768 3769 3770 3771
@"class A<T>
{
    enum SortOrder
    {
3772 3773 3774 3775
        Ascending,
        Descending,
        None
    }
C
CyrusNajmabadi 已提交
3776

3777
    void Goo()
C
CyrusNajmabadi 已提交
3778
    {
3779 3780 3781 3782 3783 3784
        var b = $$SortOrder.Ascending;
    }
}",
                MainDescription(@"enum A<T>.SortOrder"));
        }

J
Jared Parsons 已提交
3785
        [WorkItem(546970, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546970")]
3786
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3787
        public async Task TestUnconstructedGenericInCRef()
3788
        {
C
Cyrus Najmabadi 已提交
3789
            await TestAsync(
C
CyrusNajmabadi 已提交
3790 3791 3792 3793
@"/// <see cref=""$$C{T}"" />
class C<T>
{
}",
3794 3795 3796
                MainDescription(@"class C<T>"));
        }

3797
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3798
        public async Task TestAwaitableMethod()
3799 3800 3801 3802
        {
            var markup = @"using System.Threading.Tasks;
class C
{
3803
    async Task Goo()
3804
    {
3805
        Go$$o();
3806 3807
    }
}";
3808
            var description = $"({CSharpFeaturesResources.awaitable}) Task C.Goo()";
3809

3810
            var documentation = $@"
3811
{WorkspacesResources.Usage_colon}
3812
  {SyntaxFacts.GetText(SyntaxKind.AwaitKeyword)} Goo();";
3813

C
Cyrus Najmabadi 已提交
3814
            await VerifyWithMscorlib45Async(markup, new[] { MainDescription(description), Usage(documentation) });
3815 3816
        }

3817
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3818
        public async Task ObsoleteItem()
3819 3820 3821 3822 3823 3824 3825
        {
            var markup = @"
using System;

class Program
{
    [Obsolete]
3826
    public void goo()
3827
    {
3828
        go$$o();
3829 3830
    }
}";
3831
            await TestAsync(markup, MainDescription($"[{CSharpFeaturesResources.deprecated}] void Program.goo()"));
3832 3833
        }

J
Jared Parsons 已提交
3834
        [WorkItem(751070, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751070")]
3835
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3836
        public async Task DynamicOperator()
3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851
        {
            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 已提交
3852
            await TestAsync(markup, MainDescription("dynamic dynamic.operator ==(dynamic left, dynamic right)"));
3853 3854
        }

3855
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3856
        public async Task TextOnlyDocComment()
3857
        {
C
CyrusNajmabadi 已提交
3858 3859
            await TestAsync(
@"/// <summary>
3860
///goo
3861 3862 3863
/// </summary>
class C$$
{
3864
}", Documentation("goo"));
3865 3866
        }

3867
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3868
        public async Task TestTrimConcatMultiLine()
3869
        {
C
CyrusNajmabadi 已提交
3870 3871
            await TestAsync(
@"/// <summary>
3872
/// goo
3873 3874 3875 3876
/// bar
/// </summary>
class C$$
{
3877
}", Documentation("goo bar"));
3878 3879
        }

3880
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3881
        public async Task TestCref()
3882
        {
C
CyrusNajmabadi 已提交
3883 3884
            await TestAsync(
@"/// <summary>
3885 3886 3887 3888 3889 3890 3891 3892
/// <see cref=""C""/>
/// <seealso cref=""C""/>
/// </summary>
class C$$
{
}", Documentation("C C"));
        }

3893
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3894
        public async Task ExcludeTextOutsideSummaryBlock()
3895
        {
C
CyrusNajmabadi 已提交
3896 3897
            await TestAsync(
@"/// red
3898 3899 3900 3901 3902 3903 3904 3905 3906
/// <summary>
/// green
/// </summary>
/// yellow
class C$$
{
}", Documentation("green"));
        }

3907
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3908
        public async Task NewlineAfterPara()
3909
        {
C
CyrusNajmabadi 已提交
3910 3911
            await TestAsync(
@"/// <summary>
3912
/// <para>goo</para>
3913 3914 3915
/// </summary>
class C$$
{
3916
}", Documentation("goo"));
3917 3918
        }

3919
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3920
        public async Task TextOnlyDocComment_Metadata()
3921 3922 3923
        {
            var referenced = @"
/// <summary>
3924
///goo
3925 3926 3927 3928 3929 3930 3931 3932
/// </summary>
public class C
{
}";

            var code = @"
class G
{
3933
    void goo()
3934 3935 3936 3937
    {
        C$$ c;
    }
}";
3938
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("goo"));
3939 3940
        }

3941
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3942
        public async Task TestTrimConcatMultiLine_Metadata()
3943 3944 3945
        {
            var referenced = @"
/// <summary>
3946
/// goo
3947 3948 3949 3950 3951 3952 3953 3954 3955
/// bar
/// </summary>
public class C
{
}";

            var code = @"
class G
{
3956
    void goo()
3957 3958 3959 3960
    {
        C$$ c;
    }
}";
3961
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("goo bar"));
3962 3963
        }

3964
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3965
        public async Task TestCref_Metadata()
3966 3967 3968 3969
        {
            var code = @"
class G
{
3970
    void goo()
3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982
    {
        C$$ c;
    }
}";

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

3986
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3987
        public async Task ExcludeTextOutsideSummaryBlock_Metadata()
3988 3989 3990 3991
        {
            var code = @"
class G
{
3992
    void goo()
3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006
    {
        C$$ c;
    }
}";

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

4010
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4011
        public async Task Param()
4012
        {
C
CyrusNajmabadi 已提交
4013 4014
            await TestAsync(
@"/// <summary></summary>
4015 4016
public class C
{
4017 4018 4019 4020
    /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param>
    public void Goo<T>(string[] arg$$s, T otherParam)
4021 4022
    {
    }
4023
}", Documentation("First parameter of C.Goo<T>(string[], T)"));
4024 4025
        }

4026
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4027
        public async Task Param_Metadata()
4028 4029 4030 4031
        {
            var code = @"
class G
{
4032
    void goo()
4033 4034
    {
        C c;
4035
        c.Goo<int>(arg$$s: new string[] { }, 1);
4036 4037 4038 4039 4040 4041
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
4042 4043 4044 4045
    /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param>
    public void Goo<T>(string[] args, T otherParam)
4046 4047 4048
    {
    }
}";
4049
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("First parameter of C.Goo<T>(string[], T)"));
4050 4051
        }

4052
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4053
        public async Task Param2()
4054
        {
C
CyrusNajmabadi 已提交
4055 4056
            await TestAsync(
@"/// <summary></summary>
4057 4058
public class C
{
4059 4060 4061 4062
    /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param>
    public void Goo<T>(string[] args, T oth$$erParam)
4063 4064
    {
    }
4065
}", Documentation("Another parameter of C.Goo<T>(string[], T)"));
4066 4067
        }

4068
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4069
        public async Task Param2_Metadata()
4070 4071 4072 4073
        {
            var code = @"
class G
{
4074
    void goo()
4075 4076
    {
        C c;
4077
        c.Goo<int>(args: new string[] { }, other$$Param: 1);
4078 4079 4080 4081 4082 4083
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
4084 4085 4086 4087
    /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param>
    public void Goo<T>(string[] args, T otherParam)
4088 4089 4090
    {
    }
}";
4091
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("Another parameter of C.Goo<T>(string[], T)"));
4092 4093
        }

4094
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4095
        public async Task TypeParam()
4096
        {
C
CyrusNajmabadi 已提交
4097 4098
            await TestAsync(
@"/// <summary></summary>
4099 4100
public class C
{
4101 4102 4103 4104
    /// <typeparam name=""T"">A type parameter of <see cref=""Goo{T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param>
    public void Goo<T$$>(string[] args, T otherParam)
4105 4106
    {
    }
4107
}", Documentation("A type parameter of C.Goo<T>(string[], T)"));
4108 4109
        }

4110
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4111
        public async Task UnboundCref()
4112
        {
C
CyrusNajmabadi 已提交
4113 4114
            await TestAsync(
@"/// <summary></summary>
4115 4116
public class C
{
4117 4118 4119 4120
    /// <typeparam name=""T"">A type parameter of <see cref=""goo{T}(string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param>
    public void Goo<T$$>(string[] args, T otherParam)
4121 4122
    {
    }
4123
}", Documentation("A type parameter of goo<T>(string[], T)"));
4124 4125
        }

4126
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4127
        public async Task CrefInConstructor()
4128
        {
C
CyrusNajmabadi 已提交
4129 4130
            await TestAsync(
@"public class TestClass
4131 4132 4133 4134 4135 4136 4137 4138 4139 4140
{
    /// <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."));
        }

4141
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4142
        public async Task CrefInConstructorOverloaded()
4143
        {
C
CyrusNajmabadi 已提交
4144 4145
            await TestAsync(
@"public class TestClass
4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157
{
    /// <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 已提交
4158 4159 4160
    {
    }
}", Documentation("This sample shows how to specify the TestClass(int) constructor as a cref attribute."));
4161 4162
        }

4163
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4164
        public async Task CrefInGenericMethod1()
4165
        {
C
CyrusNajmabadi 已提交
4166 4167
            await TestAsync(
@"public class TestClass
4168
{
C
CyrusNajmabadi 已提交
4169 4170 4171 4172 4173 4174 4175 4176 4177
    /// <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."));
4178 4179
        }

4180
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4181
        public async Task CrefInGenericMethod2()
4182
        {
C
CyrusNajmabadi 已提交
4183 4184
            await TestAsync(
@"public class TestClass
4185
{
C
CyrusNajmabadi 已提交
4186 4187 4188 4189 4190 4191 4192 4193 4194
    /// <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."));
4195 4196
        }

J
Jared Parsons 已提交
4197
        [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")]
4198
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4199
        public async Task CrefInMethodOverloading1()
4200
        {
C
CyrusNajmabadi 已提交
4201 4202
            await TestAsync(
@"public class TestClass
4203
{
C
CyrusNajmabadi 已提交
4204 4205 4206 4207 4208
    public static int GetZero()
    {
        GetGenericValu$$e();
        GetGenericValue(5);
    }
4209

C
CyrusNajmabadi 已提交
4210 4211 4212 4213 4214 4215 4216
    /// <summary> 
    /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
    /// </summary> 
    public static T GetGenericValue<T>(T para)
    {
        return para;
    }
4217

C
CyrusNajmabadi 已提交
4218 4219 4220 4221 4222 4223 4224
    /// <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."));
4225 4226
        }

J
Jared Parsons 已提交
4227
        [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")]
4228
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4229
        public async Task CrefInMethodOverloading2()
4230
        {
C
CyrusNajmabadi 已提交
4231 4232
            await TestAsync(
@"public class TestClass
4233
{
C
CyrusNajmabadi 已提交
4234 4235 4236 4237 4238
    public static int GetZero()
    {
        GetGenericValue();
        GetGenericVal$$ue(5);
    }
4239

C
CyrusNajmabadi 已提交
4240 4241 4242 4243 4244 4245 4246
    /// <summary> 
    /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
    /// </summary> 
    public static T GetGenericValue<T>(T para)
    {
        return para;
    }
4247

C
CyrusNajmabadi 已提交
4248 4249 4250 4251 4252 4253 4254
    /// <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"));
4255 4256
        }

4257
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4258
        public async Task CrefInGenericType()
4259
        {
C
CyrusNajmabadi 已提交
4260 4261 4262 4263 4264 4265 4266
            await TestAsync(
@"/// <summary> 
/// <remarks>This example shows how to specify the <see cref=""GenericClass{T}""/> cref.</remarks>
/// </summary> 
class Generic$$Class<T>
{
}",
4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278
    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 已提交
4279
        [WorkItem(812720, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/812720")]
4280
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4281
        public async Task ClassificationOfCrefsFromMetadata()
4282 4283 4284 4285
        {
            var code = @"
class G
{
4286
    void goo()
4287 4288
    {
        C c;
4289
        c.Go$$o();
4290 4291 4292 4293 4294 4295 4296
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
    /// <summary> 
4297
    /// See <see cref=""Goo""/> method
4298
    /// </summary> 
4299
    public void Goo()
4300 4301 4302
    {
    }
}";
C
Cyrus Najmabadi 已提交
4303
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#",
4304
                Documentation("See C.Goo() method",
4305 4306 4307 4308 4309
                    ExpectedClassifications(
                        Text("See"),
                        WhiteSpace(" "),
                        Class("C"),
                        Punctuation.Text("."),
4310
                        Identifier("Goo"),
4311 4312 4313 4314 4315 4316
                        Punctuation.OpenParen,
                        Punctuation.CloseParen,
                        WhiteSpace(" "),
                        Text("method"))));
        }

4317
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4318
        public async Task FieldAvailableInBothLinkedFiles()
4319 4320 4321 4322 4323 4324 4325
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    int x;
4326
    void goo()
4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

4339
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.field}) int C.x"), Usage("") });
4340 4341
        }

4342
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4343
        public async Task FieldUnavailableInOneLinkedFile()
4344 4345
        {
            var markup = @"<Workspace>
4346
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO"">
4347 4348 4349
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
4350
#if GOO
4351 4352
    int x;
#endif
4353
    void goo()
4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
4365
            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);
4366

C
Cyrus Najmabadi 已提交
4367
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4368 4369
        }

4370
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4371
        public async Task BindSymbolInOtherFile()
4372 4373 4374 4375 4376 4377
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
4378
#if GOO
4379 4380
    int x;
#endif
4381
    void goo()
4382 4383 4384 4385 4386 4387 4388
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
4389
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""GOO"">
4390 4391 4392
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
4393
            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);
4394

C
Cyrus Najmabadi 已提交
4395
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4396 4397
        }

4398
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4399
        public async Task FieldUnavailableInTwoLinkedFiles()
4400 4401
        {
            var markup = @"<Workspace>
4402
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO"">
4403 4404 4405
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
4406
#if GOO
4407 4408
    int x;
#endif
4409
    void goo()
4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424
    {
        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(
4425
                $"\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}",
4426 4427
                expectsWarningGlyph: true);

C
Cyrus Najmabadi 已提交
4428
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4429 4430
        }

4431
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4432
        public async Task ExcludeFilesWithInactiveRegions()
4433 4434
        {
            var markup = @"<Workspace>
4435
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO,BAR"">
4436 4437 4438
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
4439
#if GOO
4440 4441 4442 4443
    int x;
#endif

#if BAR
4444
    void goo()
4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459
    {
        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>";
4460
            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 已提交
4461
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4462 4463
        }

J
Jared Parsons 已提交
4464
        [WorkItem(962353, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/962353")]
4465
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4466
        public async Task NoValidSymbolsInLinkedDocuments()
4467 4468 4469 4470 4471 4472
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
4473
    void goo()
4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488
    {
        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 已提交
4489
            await VerifyWithReferenceWorkerAsync(markup);
4490 4491
        }

J
Jared Parsons 已提交
4492
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4493
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4494
        public async Task LocalsValidInLinkedDocuments()
4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513
        {
            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>";

4514
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage("") });
4515 4516
        }

J
Jared Parsons 已提交
4517
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4518
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4519
        public async Task LocalWarningInLinkedDocuments()
4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542
        {
            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>";

4543
            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) });
4544 4545
        }

J
Jared Parsons 已提交
4546
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4547
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4548
        public async Task LabelsValidInLinkedDocuments()
4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567
        {
            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>";

4568
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.label}) LABEL"), Usage("") });
4569 4570
        }

J
Jared Parsons 已提交
4571
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4572
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4573
        public async Task RangeVariablesValidInLinkedDocuments()
4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593
        {
            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>";

4594
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.range_variable}) int y"), Usage("") });
4595 4596
        }

J
Jared Parsons 已提交
4597
        [WorkItem(1019766, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1019766")]
4598
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4599
        public async Task PointerAccessibility()
4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610
        {
            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 已提交
4611
            await TestAsync(markup, MainDescription("bool void*.operator ==(void* left, void* right)"));
4612 4613
        }

J
Jared Parsons 已提交
4614
        [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")]
4615
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4616
        public async Task AwaitingTaskOfArrayType()
4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627
        {
            var markup = @"
using System.Threading.Tasks;

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

J
Jared Parsons 已提交
4631
        [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")]
4632
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4633
        public async Task AwaitingTaskOfDynamic()
4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644
        {
            var markup = @"
using System.Threading.Tasks;

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

4648
        [Fact, Trait(Traits.Feature, Traits.Features.Completion)]
C
Cyrus Najmabadi 已提交
4649
        public async Task MethodOverloadDifferencesIgnored()
4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674
        {
            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 已提交
4675
            await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription));
4676
        }
4677

4678
        [Fact, Trait(Traits.Feature, Traits.Features.Completion)]
C
Cyrus Najmabadi 已提交
4679
        public async Task MethodOverloadDifferencesIgnored_ContainingType()
4680 4681 4682 4683 4684 4685 4686 4687 4688 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
        {
            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 已提交
4728
            await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription));
4729
        }
4730 4731 4732

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

4738 4739
namespace MyNs
{
C
CyrusNajmabadi 已提交
4740 4741 4742 4743 4744 4745 4746 4747
    class MyException1 : Exception
    {
    }

    class MyException2 : Exception
    {
    }

4748 4749 4750 4751 4752 4753
    class TestClass
    {
        /// <exception cref=""MyException1""></exception>
        /// <exception cref=""T:MyNs.MyException2""></exception>
        /// <exception cref=""System.Int32""></exception>
        /// <exception cref=""double""></exception>
4754
        /// <exception cref=""Not_A_Class_But_Still_Displayed""></exception>
4755 4756 4757 4758 4759
        void M()
        {
            M$$();
        }
    }
C
CyrusNajmabadi 已提交
4760
}",
4761
                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"));
4762
        }
4763 4764 4765

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

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(6657, "https://github.com/dotnet/roslyn/issues/6657")]
4787
        public async Task OptionalParameterFromPreviousSubmission()
4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798
        {
            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
CyrusNajmabadi 已提交
4799
            using (var workspace = TestWorkspace.Create(XElement.Parse(workspaceDefinition), workspaceKind: WorkspaceKind.Interactive))
4800
            {
4801
                await TestWithOptionsAsync(workspace, MainDescription("(parameter) int x = 1"));
4802 4803
            }
        }
C
CyrusNajmabadi 已提交
4804 4805 4806 4807

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TupleProperty()
        {
4808 4809
            await TestInMethodAsync(
@"interface I
C
CyrusNajmabadi 已提交
4810 4811 4812
{
    (int, int) Name { get; set; }
}
4813

C
CyrusNajmabadi 已提交
4814 4815 4816 4817
class C : I
{
    (int, int) I.Name$$
    {
4818 4819 4820 4821 4822 4823 4824 4825
        get
        {
            throw new System.Exception();
        }

        set
        {
        }
C
CyrusNajmabadi 已提交
4826 4827 4828 4829
    }
}",
                MainDescription("(int, int) C.Name { get; set; }"));
        }
4830

4831 4832 4833 4834 4835 4836 4837 4838 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 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938
        [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task ValueTupleWithArity0VariableName()
        {
            await TestAsync(
@"
using System;
public class C
{
    void M()
    {
        var y$$ = ValueTuple.Create();
    }
}
" + TestResources.NetFX.ValueTuple.tuplelib_cs,
                MainDescription("(local variable) ValueTuple y"));
        }

        [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task ValueTupleWithArity0ImplicitVar()
        {
            await TestAsync(
@"
using System;
public class C
{
    void M()
    {
        var$$ y = ValueTuple.Create();
    }
}
" + TestResources.NetFX.ValueTuple.tuplelib_cs,
                MainDescription("struct System.ValueTuple"));
        }

        [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task ValueTupleWithArity1VariableName()
        {
            await TestAsync(
@"
using System;
public class C
{
    void M()
    {
        var y$$ = ValueTuple.Create(1);
    }
}
" + TestResources.NetFX.ValueTuple.tuplelib_cs,
                MainDescription("(local variable) ValueTuple<int> y"));
        }

        [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task ValueTupleWithArity1ImplicitVar()
        {
            await TestAsync(
@"
using System;
public class C
{
    void M()
    {
        var$$ y = ValueTuple.Create(1);
    }
}
" + TestResources.NetFX.ValueTuple.tuplelib_cs,
                MainDescription("ValueTuple<System.Int32>"));
        }

        [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task ValueTupleWithArity2VariableName()
        {
            await TestAsync(
@"
using System;
public class C
{
    void M()
    {
        var y$$ = ValueTuple.Create(1, 1);
    }
}
" + TestResources.NetFX.ValueTuple.tuplelib_cs,
                MainDescription("(local variable) (int, int) y"));
        }

        [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task ValueTupleWithArity2ImplicitVar()
        {
            await TestAsync(
@"
using System;
public class C
{
    void M()
    {
        var$$ y = ValueTuple.Create(1, 1);
    }
}
" + TestResources.NetFX.ValueTuple.tuplelib_cs,
                MainDescription("(System.Int32, System.Int32)"));
        }

4939 4940 4941 4942 4943 4944 4945 4946 4947 4948
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestRefMethod()
        {
            await TestInMethodAsync(
@"using System;

class Program
{
    static void Main(string[] args)
    {
4949
        ref int i = ref $$goo();
4950 4951
    }

4952
    private static ref int goo()
4953 4954 4955 4956
    {
        throw new NotImplementedException();
    }
}",
4957
                MainDescription("ref int Program.goo()"));
4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969
        }

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

class Program
{
    static void Main(string[] args)
    {
4970
        ref int $$i = ref goo();
4971 4972
    }

4973
    private static ref int goo()
4974 4975 4976 4977 4978 4979
    {
        throw new NotImplementedException();
    }
}",
                MainDescription($"({FeaturesResources.local_variable}) ref int i"));
        }
A
AlekseyTs 已提交
4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(410932, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=410932")]
        public async Task TestGenericMethodInDocComment()
        {
            await TestAsync(
@"
class Test
{
    T F<T>()
    {
        F<T>();
    }

    /// <summary>
    /// <see cref=""F$${T}()""/>
    /// </summary>
    void S()
    { }
}
",
            MainDescription("T Test.F<T>()"));
        }
R
Ravi Chande 已提交
5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(403665, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=403665&_a=edit")]
        public async Task TestExceptionWithCrefToConstructorDoesNotCrash()
        {
            await TestAsync(
@"
class Test
{
    /// <summary>
    /// </summary>
    /// <exception cref=""Test.Test""/>
    public Test$$() {}
}
",
            MainDescription("Test.Test()"));
        }
5020

5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestRefStruct()
        {
            var markup = "ref struct X$$ {}";
            await TestAsync(markup, MainDescription("ref struct X"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestRefStruct_Nested()
        {
            var markup = @"
namespace Nested
{
    ref struct X$$ {}
}";
            await TestAsync(markup, MainDescription("ref struct Nested.X"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestReadOnlyStruct()
        {
            var markup = "readonly struct X$$ {}";
            await TestAsync(markup, MainDescription("readonly struct X"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestReadOnlyStruct_Nested()
        {
            var markup = @"
namespace Nested
{
    readonly struct X$$ {}
}";
            await TestAsync(markup, MainDescription("readonly struct Nested.X"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestReadOnlyRefStruct()
        {
            var markup = "readonly ref struct X$$ {}";
            await TestAsync(markup, MainDescription("readonly ref struct X"));
        }

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestReadOnlyRefStruct_Nested()
        {
            var markup = @"
namespace Nested
{
    readonly ref struct X$$ {}
}";
            await TestAsync(markup, MainDescription("readonly ref struct Nested.X"));
        }

5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098
        [WorkItem(22450, "https://github.com/dotnet/roslyn/issues/22450")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TestRefLikeTypesNoDeprecated()
        {
            var xmlString = @"
<Workspace>
    <Project Language=""C#"" LanguageVersion=""702"" CommonReferences=""true"">
        <MetadataReferenceFromSource Language=""C#"" LanguageVersion=""702"" CommonReferences=""true"">
            <Document FilePath=""ReferencedDocument"">
public ref struct TestRef
{
}
            </Document>
        </MetadataReferenceFromSource>
        <Document FilePath=""SourceDocument"">
ref struct Test
{
    private $$TestRef _field;
}
        </Document>
    </Project>
</Workspace>";

            // There should be no [deprecated] attribute displayed.
5099
            await VerifyWithReferenceWorkerAsync(xmlString, MainDescription($"ref struct TestRef"));
5100
        }
5101

V
Victor Zaytsev 已提交
5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126
        [WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task PropertyWithSameNameAsOtherType()
        {
            await TestAsync(
@"namespace ConsoleApplication1
{
    class Program
    {
        static A B { get; set; }
        static B A { get; set; }

        static void Main(string[] args)
        {
            B = ConsoleApplication1.B$$.F();
        }
    }
    class A { }
    class B
    {
        public static A F() => null;
    }
}",
            MainDescription($"ConsoleApplication1.A ConsoleApplication1.B.F()"));
        }
V
Victor Zaytsev 已提交
5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153

        [WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task PropertyWithSameNameAsOtherType2()
        {
            await TestAsync(
@"using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        public static List<Bar> Bar { get; set; }

        static void Main(string[] args)
        {
            Tes$$t<Bar>();
        }

        static void Test<T>() { }
    }

    class Bar
    {
    }
}",
            MainDescription($"void Program.Test<Bar>()"));
5154
        }
5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193

        [WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task InMalformedEmbeddedStatement_01()
        {
            await TestAsync(
@"
class Program
{
    void method1()
    {
        if (method2())
            .Any(b => b.Content$$Type, out var chars)
        {
        }
    }
}
");
        }

        [WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")]
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task InMalformedEmbeddedStatement_02()
        {
            await TestAsync(
@"
class Program
{
    void method1()
    {
        if (method2())
            .Any(b => b$$.ContentType, out var chars)
        {
        }
    }
}
",
            MainDescription("(parameter) ? b"));
        }
5194
    }
S
Sam Harwell 已提交
5195
}