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

using System;
using System.Linq;
using System.Security;
using System.Threading;
C
Cyrus Najmabadi 已提交
7
using System.Threading.Tasks;
8
using System.Xml.Linq;
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Editor.CSharp.QuickInfo;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Projection;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;

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

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

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

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

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

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

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

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

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

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

C
Cyrus Najmabadi 已提交
98
            using (var workspace = await TestWorkspace.CreateAsync(xmlString))
99 100 101 102 103 104 105 106 107 108 109 110
            {
                var position = workspace.Documents.Single(d => d.Name == "SourceDocument").CursorPosition.Value;
                var documentId = workspace.Documents.Where(d => d.Name == "SourceDocument").Single().Id;
                var document = workspace.CurrentSolution.GetDocument(documentId);

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

C
Cyrus Najmabadi 已提交
111
                var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
                if (state != null)
                {
                    WaitForDocumentationComment(state.Content);
                }

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

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

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

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

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

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

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

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

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

C
Cyrus Najmabadi 已提交
178
        private async Task TestWithMetadataReferenceHelperAsync(
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
            string sourceCode,
            string referencedCode,
            string sourceLanguage,
            string referencedLanguage,
            params Action<object>[] expectedResults)
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""{0}"" CommonReferences=""true"">
        <Document FilePath=""SourceDocument"">
{1}
        </Document>
        <MetadataReferenceFromSource Language=""{2}"" CommonReferences=""true"" IncludeXmlDocComments=""true"">
            <Document FilePath=""ReferencedDocument"">
{3}
            </Document>
        </MetadataReferenceFromSource>
    </Project>
</Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode),
               referencedLanguage, SecurityElement.Escape(referencedCode));

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

C
Cyrus Najmabadi 已提交
203
        private async Task TestWithProjectReferenceHelperAsync(
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
            string sourceCode,
            string referencedCode,
            string sourceLanguage,
            string referencedLanguage,
            params Action<object>[] expectedResults)
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""{0}"" CommonReferences=""true"">
        <ProjectReference>ReferencedProject</ProjectReference>
        <Document FilePath=""SourceDocument"">
{1}
        </Document>
    </Project>
    <Project Language=""{2}"" CommonReferences=""true"" AssemblyName=""ReferencedProject"">
        <Document FilePath=""ReferencedDocument"">
{3}
        </Document>
    </Project>
    
</Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode),
               referencedLanguage, SecurityElement.Escape(referencedCode));

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

C
Cyrus Najmabadi 已提交
230
        private async Task TestInSameProjectHelperAsync(
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
            string sourceCode,
            string referencedCode,
            string sourceLanguage,
            params Action<object>[] expectedResults)
        {
            var xmlString = string.Format(@"
<Workspace>
    <Project Language=""{0}"" CommonReferences=""true"">
        <Document FilePath=""SourceDocument"">
{1}
        </Document>
        <Document FilePath=""ReferencedDocument"">
{2}
        </Document>
    </Project>
</Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), SecurityElement.Escape(referencedCode));

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

C
Cyrus Najmabadi 已提交
251
        private async Task VerifyWithReferenceWorkerAsync(string xmlString, params Action<object>[] expectedResults)
252
        {
C
Cyrus Najmabadi 已提交
253
            using (var workspace = await TestWorkspace.CreateAsync(xmlString))
254 255 256 257 258 259 260 261 262 263 264 265
            {
                var position = workspace.Documents.First(d => d.Name == "SourceDocument").CursorPosition.Value;
                var documentId = workspace.Documents.First(d => d.Name == "SourceDocument").Id;
                var document = workspace.CurrentSolution.GetDocument(documentId);

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

C
Cyrus Najmabadi 已提交
266
                var state = await provider.GetItemAsync(document, position, cancellationToken: CancellationToken.None);
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
                if (state != null)
                {
                    WaitForDocumentationComment(state.Content);
                }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void M()
{
    field$$
}";

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

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

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

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

void M()
{
    int f = field$$;
}");
1005 1006
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void M()
{
    field$$
}";

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

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

void M()
{
    file$$
}";

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

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

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

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

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

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

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

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

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

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

1174
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1175
        public async Task TestMetadataFieldQualified1()
1176 1177 1178 1179 1180 1181 1182 1183 1184
        {
            // NOTE: we qualify the field type, but not the type that contains the field in Dev10
            var markup =
@"class C {
    void M()
    {
        DateTime dt = System.DateTime.MaxValue$$
    }
}";
C
Cyrus Najmabadi 已提交
1185
            await TestAsync(markup,
1186
                MainDescription($"({FeaturesResources.field}) System.DateTime System.DateTime.MaxValue"));
1187 1188
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

J
Jared Parsons 已提交
1322
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1323
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1324
        public async Task TestNestedAwaitKeywords1()
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353
        {
            var markup = @"using System;
using System.Threading.Tasks;
class AsyncExample2
{
    async Task<Task<int>> AsyncMethod()
    {
        return NewMethod();
    }

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

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

        int result = await await AsyncMethod();
        Task<Task<int>> resultTask = AsyncMethod();
        result = await awa$$it resultTask;
        result = await lambda();
    }
}";
1354 1355
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) {FeaturesResources.Awaited_task_returns} class System.Threading.Tasks.Task<TResult>"),
                         TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int"));
1356 1357
        }

J
Jared Parsons 已提交
1358
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")]
1359
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1360
        public async Task TestNestedAwaitKeywords2()
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389
        {
            var markup = @"using System;
using System.Threading.Tasks;
class AsyncExample2
{
    async Task<Task<int>> AsyncMethod()
    {
        return NewMethod();
    }

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

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

        int result = await await AsyncMethod();
        Task<Task<int>> resultTask = AsyncMethod();
        result = awa$$it await resultTask;
        result = await lambda();
    }
}";
1390
            await TestAsync(markup, MainDescription($"{FeaturesResources.Awaited_task_returns} struct System.Int32"));
1391 1392
        }

J
Jared Parsons 已提交
1393
        [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")]
1394
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1395
        public async Task TestAwaitablePrefixOnCustomAwaiter()
1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416
        {
            var markup = @"using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Z = $$C;

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

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

    public bool IsCompleted { get { throw new NotImplementedException(); } }
    public void GetResult() { }
}";
1417
            await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class C"));
1418 1419
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1672
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
1673
        public async Task FlagsEnumMemberNameFromMetadata2()
1674
        {
C
Cyrus Najmabadi 已提交
1675
            await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.A$$ll",
1676 1677 1678
                MainDescription("AttributeTargets.All = AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter"));
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void Method(int i)
{
}

void Method(DateTime dt)
{
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public C(DateTime dt)
{
}

public C(int i)
{
}
1997 1998 1999

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

J
Jared Parsons 已提交
2527
        [WorkItem(540871, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540871")]
2528
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2529
        public async Task TestLiterals()
2530
        {
C
CyrusNajmabadi 已提交
2531 2532
            await TestAsync(
@"class MyClass
2533
{
C
CyrusNajmabadi 已提交
2534
    MyClass() : this($$10)
2535 2536 2537
    {
        intI = 2;
    }
C
CyrusNajmabadi 已提交
2538 2539 2540 2541 2542

    public MyClass(int i)
    {
    }

2543
    static int intI = 1;
C
CyrusNajmabadi 已提交
2544

2545 2546 2547 2548 2549 2550 2551 2552
    public static int Main()
    {
        return 1;
    }
}",
                MainDescription("struct System.Int32"));
        }

J
Jared Parsons 已提交
2553
        [WorkItem(541444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541444")]
2554
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2555
        public async Task TestErrorInForeach()
2556
        {
C
CyrusNajmabadi 已提交
2557 2558
            await TestAsync(
@"class C
2559 2560 2561 2562 2563 2564 2565 2566 2567
{
    void Main()
    {
        foreach (int cc in null)
        {
            $$cc = 1;
        }
    }
}",
2568
                MainDescription($"({FeaturesResources.local_variable}) int cc"));
2569 2570
        }

J
Jared Parsons 已提交
2571
        [WorkItem(540438, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540438")]
2572
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2573
        public async Task TestNoQuickInfoOnAnonymousDelegate()
2574
        {
C
CyrusNajmabadi 已提交
2575 2576
            await TestAsync(
@"using System;
2577 2578 2579 2580 2581

class Program
{
    static void Main(string[] args)
    {
2582
        Action a = $$delegate {
C
CyrusNajmabadi 已提交
2583
        };
2584 2585 2586 2587
    }
}");
        }

J
Jared Parsons 已提交
2588
        [WorkItem(541678, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541678")]
2589
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2590
        public async Task TestQuickInfoOnEvent()
2591
        {
C
CyrusNajmabadi 已提交
2592 2593 2594
            await TestAsync(
@"using System;

2595 2596
public class SampleEventArgs
{
C
CyrusNajmabadi 已提交
2597 2598 2599 2600 2601 2602
    public SampleEventArgs(string s)
    {
        Text = s;
    }

    public String Text { get; private set; }
2603
}
C
CyrusNajmabadi 已提交
2604

2605 2606 2607
public class Publisher
{
    public delegate void SampleEventHandler(object sender, SampleEventArgs e);
C
CyrusNajmabadi 已提交
2608

2609
    public event SampleEventHandler SampleEvent;
C
CyrusNajmabadi 已提交
2610

2611 2612 2613 2614 2615
    protected virtual void RaiseSampleEvent()
    {
        if (Sam$$pleEvent != null)
            SampleEvent(this, new SampleEventArgs(""Hello""));
    }
C
CyrusNajmabadi 已提交
2616
}",
2617 2618 2619
                MainDescription("SampleEventHandler Publisher.SampleEvent"));
        }

J
Jared Parsons 已提交
2620
        [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")]
2621
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2622
        public async Task TestEvent()
2623
        {
C
Cyrus Najmabadi 已提交
2624
            await TestInMethodAsync(@"System.Console.CancelKeyPres$$s += null;",
2625 2626 2627
                MainDescription("ConsoleCancelEventHandler Console.CancelKeyPress"));
        }

J
Jared Parsons 已提交
2628
        [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")]
2629
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2630
        public async Task TestEventPlusEqualsOperator()
2631
        {
C
Cyrus Najmabadi 已提交
2632
            await TestInMethodAsync(@"System.Console.CancelKeyPress +$$= null;",
2633 2634 2635
                MainDescription("void Console.CancelKeyPress.add"));
        }

J
Jared Parsons 已提交
2636
        [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")]
2637
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2638
        public async Task TestEventMinusEqualsOperator()
2639
        {
C
Cyrus Najmabadi 已提交
2640
            await TestInMethodAsync(@"System.Console.CancelKeyPress -$$= null;",
2641 2642 2643
                MainDescription("void Console.CancelKeyPress.remove"));
        }

J
Jared Parsons 已提交
2644
        [WorkItem(541885, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541885")]
2645
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2646
        public async Task TestQuickInfoOnExtensionMethod()
2647
        {
2648 2649
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2650 2651
using System.Collections.Generic;
using System.Linq;
2652

2653 2654 2655 2656
class Program
{
    static void Main(string[] args)
    {
2657 2658 2659
        int[] values = {
            1
        };
2660 2661 2662
        bool isArray = 7.I$$n(values);
    }
}
2663

2664 2665 2666 2667 2668 2669
public static class MyExtensions
{
    public static bool In<T>(this T o, IEnumerable<T> items)
    {
        return true;
    }
2670
}",
2671
                MainDescription($"({CSharpFeaturesResources.extension}) bool int.In<int>(IEnumerable<int> items)"));
2672 2673
        }

2674
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2675
        public async Task TestQuickInfoOnExtensionMethodOverloads()
2676
        {
2677 2678
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2679 2680 2681 2682 2683 2684
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
2685
        ""1"".Test$$Ext();
2686 2687
    }
}
2688

2689 2690
public static class Ex
{
2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702
    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)
    {
    }
}",
2703
                MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 2 {FeaturesResources.overloads_})"));
2704 2705
        }

2706
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2707
        public async Task TestQuickInfoOnExtensionMethodOverloads2()
2708
        {
2709 2710
            await TestWithOptionsAsync(Options.Regular, 
@"using System;
2711 2712 2713 2714 2715 2716
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
2717
        ""1"".Test$$Ext();
2718 2719
    }
}
2720

2721 2722
public static class Ex
{
2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734
    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)
    {
    }
}",
2735
                MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 1 {FeaturesResources.overload})"));
2736 2737
        }

2738
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2739
        public async Task Query1()
2740
        {
C
CyrusNajmabadi 已提交
2741 2742 2743
            await TestAsync(
@"using System.Linq;

2744 2745 2746 2747
class C
{
    void M()
    {
C
CyrusNajmabadi 已提交
2748 2749
        var q = from n in new int[] { 1, 2, 3, 4, 5 }

2750 2751
                select $$n;
    }
C
CyrusNajmabadi 已提交
2752
}",
2753
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2754 2755
        }

2756
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2757
        public async Task Query2()
2758
        {
C
CyrusNajmabadi 已提交
2759 2760 2761
            await TestAsync(
@"using System.Linq;

2762 2763 2764 2765
class C
{
    void M()
    {
C
CyrusNajmabadi 已提交
2766 2767
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5 }

2768 2769
                select n;
    }
C
CyrusNajmabadi 已提交
2770
}",
2771
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2772 2773
        }

2774
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2775
        public async Task Query3()
2776
        {
C
CyrusNajmabadi 已提交
2777 2778
            await TestAsync(
@"class C
2779 2780 2781
{
    void M()
    {
C
CyrusNajmabadi 已提交
2782 2783
        var q = from n in new int[] { 1, 2, 3, 4, 5 }

2784 2785
                select $$n;
    }
C
CyrusNajmabadi 已提交
2786
}",
2787
                MainDescription($"({FeaturesResources.range_variable}) ? n"));
2788 2789
        }

2790
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2791
        public async Task Query4()
2792
        {
C
CyrusNajmabadi 已提交
2793 2794
            await TestAsync(
@"class C
2795 2796 2797
{
    void M()
    {
C
CyrusNajmabadi 已提交
2798 2799
        var q = from n$$ in new int[] { 1, 2, 3, 4, 5 }

2800 2801
                select n;
    }
C
CyrusNajmabadi 已提交
2802
}",
2803
                MainDescription($"({FeaturesResources.range_variable}) ? n"));
2804 2805
        }

2806
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2807
        public async Task Query5()
2808
        {
C
CyrusNajmabadi 已提交
2809 2810
            await TestAsync(
@"using System.Collections.Generic;
2811
using System.Linq;
C
CyrusNajmabadi 已提交
2812

2813 2814 2815 2816 2817 2818 2819
class C
{
    void M()
    {
        var q = from n in new List<object>()
                select $$n;
    }
C
CyrusNajmabadi 已提交
2820
}",
2821
                MainDescription($"({FeaturesResources.range_variable}) object n"));
2822 2823
        }

2824
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2825
        public async Task Query6()
2826
        {
C
CyrusNajmabadi 已提交
2827 2828
            await TestAsync(
@"using System.Collections.Generic;
2829
using System.Linq;
C
CyrusNajmabadi 已提交
2830

2831 2832 2833 2834 2835 2836 2837
class C
{
    void M()
    {
        var q = from n$$ in new List<object>()
                select n;
    }
C
CyrusNajmabadi 已提交
2838
}",
2839
                MainDescription($"({FeaturesResources.range_variable}) object n"));
2840 2841
        }

2842
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2843
        public async Task Query7()
2844
        {
C
CyrusNajmabadi 已提交
2845 2846
            await TestAsync(
@"using System.Collections.Generic;
2847
using System.Linq;
C
CyrusNajmabadi 已提交
2848

2849 2850 2851 2852 2853 2854 2855
class C
{
    void M()
    {
        var q = from int n in new List<object>()
                select $$n;
    }
C
CyrusNajmabadi 已提交
2856
}",
2857
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2858 2859
        }

2860
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2861
        public async Task Query8()
2862
        {
C
CyrusNajmabadi 已提交
2863 2864
            await TestAsync(
@"using System.Collections.Generic;
2865
using System.Linq;
C
CyrusNajmabadi 已提交
2866

2867 2868 2869 2870 2871 2872 2873
class C
{
    void M()
    {
        var q = from int n$$ in new List<object>()
                select n;
    }
C
CyrusNajmabadi 已提交
2874
}",
2875
                MainDescription($"({FeaturesResources.range_variable}) int n"));
2876 2877
        }

2878
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2879
        public async Task Query9()
2880
        {
C
CyrusNajmabadi 已提交
2881 2882
            await TestAsync(
@"using System.Collections.Generic;
2883
using System.Linq;
C
CyrusNajmabadi 已提交
2884

2885 2886 2887 2888 2889 2890 2891 2892
class C
{
    void M()
    {
        var q = from x$$ in new List<List<int>>()
                from y in x
                select y;
    }
C
CyrusNajmabadi 已提交
2893
}",
2894
                MainDescription($"({FeaturesResources.range_variable}) List<int> x"));
2895 2896
        }

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

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

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

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

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

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

J
Jared Parsons 已提交
2954
        [WorkItem(543205, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543205")]
2955
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2956
        public async Task TestErrorGlobal()
2957
        {
C
CyrusNajmabadi 已提交
2958 2959 2960
            await TestAsync(
@"extern alias global;

2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971
class myClass
{
    static int Main()
    {
        $$global::otherClass oc = new global::otherClass();
        return 0;
    }
}",
                MainDescription("<global namespace>"));
        }

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

2978 2979 2980 2981
class classAttribute : Attribute
{
    private classAttribute x$$;
}",
2982
                MainDescription($"({FeaturesResources.field}) classAttribute classAttribute.x"));
2983 2984
        }

J
Jared Parsons 已提交
2985
        [WorkItem(544026, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544026")]
2986
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
2987
        public async Task DontRemoveAttributeSuffix2()
2988
        {
C
CyrusNajmabadi 已提交
2989 2990 2991
            await TestAsync(
@"using System;

2992 2993 2994 2995
class class1Attribute : Attribute
{
    private class1Attribute x$$;
}",
2996
                MainDescription($"({FeaturesResources.field}) class1Attribute class1Attribute.x"));
2997 2998
        }

2999
        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
3000
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3001
        public async Task AttributeQuickInfoBindsToClassTest()
3002
        {
C
CyrusNajmabadi 已提交
3003 3004
            await TestAsync(
@"using System;
3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017

/// <summary>
/// class comment
/// </summary>
[Some$$]
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
    }
C
CyrusNajmabadi 已提交
3018
}",
3019 3020 3021 3022
                Documentation("class comment"));
        }

        [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")]
3023
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3024
        public async Task AttributeConstructorQuickInfo()
3025
        {
C
CyrusNajmabadi 已提交
3026 3027
            await TestAsync(
@"using System;
3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040

/// <summary>
/// class comment
/// </summary>
class SomeAttribute : Attribute
{
    /// <summary>
    /// ctor comment
    /// </summary>
    public SomeAttribute()
    {
        var s = new Some$$Attribute();
    }
C
CyrusNajmabadi 已提交
3041
}",
3042 3043 3044
                Documentation("ctor comment"));
        }

3045
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3046
        public async Task TestLabel()
3047
        {
3048 3049 3050 3051 3052 3053 3054
            await TestInClassAsync(
@"void M()
{
Foo:
    int Foo;
    goto Foo$$;
}",
3055
                MainDescription($"({FeaturesResources.label}) Foo"));
3056 3057
        }

J
Jared Parsons 已提交
3058
        [WorkItem(542613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542613")]
3059
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3060
        public async Task TestUnboundGeneric()
3061
        {
C
CyrusNajmabadi 已提交
3062 3063
            await TestAsync(
@"using System;
3064
using System.Collections.Generic;
C
CyrusNajmabadi 已提交
3065

3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076
class C
{
    void M()
    {
        Type t = typeof(L$$ist<>);
    }
}",
                MainDescription("class System.Collections.Generic.List<T>"),
                NoTypeParameterMap);
        }

J
Jared Parsons 已提交
3077
        [WorkItem(543113, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543113")]
3078
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3079
        public async Task TestAnonymousTypeNew1()
3080
        {
C
CyrusNajmabadi 已提交
3081 3082
            await TestAsync(
@"class C
3083 3084 3085 3086 3087 3088 3089 3090 3091
{
    void M()
    {
        var v = $$new { };
    }
}",
                MainDescription(@"AnonymousType 'a"),
                NoTypeParameterMap,
                AnonymousTypes(
3092
$@"
3093 3094
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{  }}"));
3095 3096
        }

J
Jared Parsons 已提交
3097
        [WorkItem(543873, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543873")]
3098
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3099
        public async Task TestNestedAnonymousType()
3100 3101 3102
        {
            // verify nested anonymous types are listed in the same order for different properties
            // verify first property
3103 3104 3105 3106
            await TestInMethodAsync(
@"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } };

x[0].$$Address",
3107 3108 3109
                MainDescription(@"'b 'a.Address { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3110
$@"
3111 3112 3113
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ string Name, 'b Address }}
    'b {FeaturesResources.is_} new {{ string Street, string Zip }}"));
3114 3115

            // verify second property
3116 3117 3118 3119
            await TestInMethodAsync(
@"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } };

x[0].$$Name",
3120 3121 3122
                MainDescription(@"string 'a.Name { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3123
$@"
3124 3125 3126
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ string Name, 'b Address }}
    'b {FeaturesResources.is_} new {{ string Street, string Zip }}"));
3127 3128
        }

3129
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
3130
        [WorkItem(543183, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543183")]
C
Cyrus Najmabadi 已提交
3131
        public async Task TestAssignmentOperatorInAnonymousType()
3132
        {
C
CyrusNajmabadi 已提交
3133 3134
            await TestAsync(
@"class C
3135 3136 3137 3138 3139
{
    void M()
    {
        var a = new { A $$= 0 };
    }
C
CyrusNajmabadi 已提交
3140
}");
3141 3142
        }

3143
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
3144
        [WorkItem(10731, "DevDiv_Projects/Roslyn")]
C
Cyrus Najmabadi 已提交
3145
        public async Task TestErrorAnonymousTypeDoesntShow()
3146
        {
3147 3148
            await TestInMethodAsync(
@"var a = new { new { N = 0 }.N, new { } }.$$N;",
3149 3150 3151
                MainDescription(@"int 'a.N { get; }"),
                NoTypeParameterMap,
                AnonymousTypes(
3152
$@"
3153 3154
{FeaturesResources.Anonymous_Types_colon}
    'a {FeaturesResources.is_} new {{ int N }}"));
3155 3156
        }

3157
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
J
Jared Parsons 已提交
3158
        [WorkItem(543553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543553")]
C
Cyrus Najmabadi 已提交
3159
        public async Task TestArrayAssignedToVar()
3160
        {
C
CyrusNajmabadi 已提交
3161 3162
            await TestAsync(
@"class C
3163 3164 3165 3166 3167
{
    static void M(string[] args)
    {
        v$$ar a = args;
    }
C
CyrusNajmabadi 已提交
3168
}",
3169 3170 3171
                MainDescription("string[]"));
        }

J
Jared Parsons 已提交
3172
        [WorkItem(529139, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529139")]
3173
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3174
        public async Task ColorColorRangeVariable()
3175
        {
C
CyrusNajmabadi 已提交
3176 3177
            await TestAsync(
@"using System.Collections.Generic;
3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192
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 已提交
3193
}",
3194
                MainDescription($"({FeaturesResources.range_variable}) N1.yield yield"));
3195 3196
        }

J
Jared Parsons 已提交
3197
        [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")]
3198
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3199
        public async Task QuickInfoOnOperator()
3200
        {
C
CyrusNajmabadi 已提交
3201 3202 3203
            await TestAsync(
@"using System.Collections.Generic;

3204 3205 3206 3207 3208 3209
class Program
{
    static void Main(string[] args)
    {
        var v = new Program() $$+ string.Empty;
    }
C
CyrusNajmabadi 已提交
3210

3211 3212 3213 3214
    public static implicit operator Program(string s)
    {
        return null;
    }
C
CyrusNajmabadi 已提交
3215

3216 3217 3218 3219 3220
    public static IEnumerable<Program> operator +(Program p1, Program p2)
    {
        yield return p1;
        yield return p2;
    }
C
CyrusNajmabadi 已提交
3221
}",
3222 3223 3224
                MainDescription("IEnumerable<Program> Program.operator +(Program p1, Program p2)"));
        }

3225
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3226
        public async Task TestConstantField()
3227
        {
C
CyrusNajmabadi 已提交
3228 3229 3230 3231
            await TestAsync(
@"class C
{
    const int $$F = 1;",
3232
                MainDescription($"({FeaturesResources.constant}) int C.F = 1"));
3233 3234
        }

3235
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3236
        public async Task TestMultipleConstantFields()
3237
        {
C
CyrusNajmabadi 已提交
3238 3239 3240 3241
            await TestAsync(
@"class C
{
    public const double X = 1.0, Y = 2.0, $$Z = 3.5;",
3242
                MainDescription($"({FeaturesResources.constant}) double C.Z = 3.5"));
3243 3244
        }

3245
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3246
        public async Task TestConstantDependencies()
3247
        {
C
CyrusNajmabadi 已提交
3248 3249
            await TestAsync(
@"class A
3250 3251 3252 3253
{
    public const int $$X = B.Z + 1;
    public const int Y = 10;
}
C
CyrusNajmabadi 已提交
3254

3255 3256 3257 3258
class B
{
    public const int Z = A.Y + 1;
}",
3259
                MainDescription($"({FeaturesResources.constant}) int A.X = B.Z + 1"));
3260 3261
        }

3262
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3263
        public async Task TestConstantCircularDependencies()
3264
        {
C
CyrusNajmabadi 已提交
3265 3266
            await TestAsync(
@"class A
3267 3268 3269
{
    public const int X = B.Z + 1;
}
C
CyrusNajmabadi 已提交
3270

3271 3272 3273 3274
class B
{
    public const int Z$$ = A.X + 1;
}",
3275
                MainDescription($"({FeaturesResources.constant}) int B.Z = A.X + 1"));
3276 3277
        }

J
Jared Parsons 已提交
3278
        [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")]
3279
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3280
        public async Task TestConstantOverflow()
3281
        {
C
CyrusNajmabadi 已提交
3282 3283
            await TestAsync(
@"class B
3284 3285 3286
{
    public const int Z$$ = int.MaxValue + 1;
}",
3287
                MainDescription($"({FeaturesResources.constant}) int B.Z = int.MaxValue + 1"));
3288 3289
        }

J
Jared Parsons 已提交
3290
        [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")]
3291
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3292
        public async Task TestConstantOverflowInUncheckedContext()
3293
        {
C
CyrusNajmabadi 已提交
3294 3295
            await TestAsync(
@"class B
3296 3297 3298
{
    public const int Z$$ = unchecked(int.MaxValue + 1);
}",
3299
                MainDescription($"({FeaturesResources.constant}) int B.Z = unchecked(int.MaxValue + 1)"));
3300 3301
        }

3302
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3303
        public async Task TestEnumInConstantField()
3304
        {
C
CyrusNajmabadi 已提交
3305 3306
            await TestAsync(
@"public class EnumTest
3307
{
C
CyrusNajmabadi 已提交
3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318
    enum Days
    {
        Sun,
        Mon,
        Tue,
        Wed,
        Thu,
        Fri,
        Sat
    };

3319 3320 3321 3322 3323
    static void Main()
    {
        const int $$x = (int)Days.Sun;
    }
}",
3324
                MainDescription($"({FeaturesResources.local_constant}) int x = (int)Days.Sun"));
3325 3326
        }

3327
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3328
        public async Task TestConstantInDefaultExpression()
3329
        {
C
CyrusNajmabadi 已提交
3330 3331
            await TestAsync(
@"public class EnumTest
3332
{
C
CyrusNajmabadi 已提交
3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343
    enum Days
    {
        Sun,
        Mon,
        Tue,
        Wed,
        Thu,
        Fri,
        Sat
    };

3344 3345 3346 3347 3348
    static void Main()
    {
        const Days $$x = default(Days);
    }
}",
3349
                MainDescription($"({FeaturesResources.local_constant}) Days x = default(Days)"));
3350 3351
        }

3352
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3353
        public async Task TestConstantParameter()
3354
        {
C
CyrusNajmabadi 已提交
3355 3356 3357 3358 3359
            await TestAsync(
@"class C
{
    void Bar(int $$b = 1);
}",
3360
                MainDescription($"({FeaturesResources.parameter}) int b = 1"));
3361 3362
        }

3363
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3364
        public async Task TestConstantLocal()
3365
        {
C
CyrusNajmabadi 已提交
3366 3367 3368 3369 3370 3371 3372
            await TestAsync(
@"class C
{
    void Bar()
    {
        const int $$loc = 1;
    }",
3373
                MainDescription($"({FeaturesResources.local_constant}) int loc = 1"));
3374 3375
        }

J
Jared Parsons 已提交
3376
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3377
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3378
        public async Task TestErrorType1()
3379
        {
3380 3381
            await TestInMethodAsync(
@"var $$v1 = new Foo();",
3382
                MainDescription($"({FeaturesResources.local_variable}) Foo v1"));
3383 3384
        }

J
Jared Parsons 已提交
3385
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3386
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3387
        public async Task TestErrorType2()
3388
        {
3389 3390
            await TestInMethodAsync(
@"var $$v1 = v1;",
3391
                MainDescription($"({FeaturesResources.local_variable}) var v1"));
3392 3393
        }

J
Jared Parsons 已提交
3394
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3395
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3396
        public async Task TestErrorType3()
3397
        {
3398 3399
            await TestInMethodAsync(
@"var $$v1 = new Foo<Bar>();",
3400
                MainDescription($"({FeaturesResources.local_variable}) Foo<Bar> v1"));
3401 3402
        }

J
Jared Parsons 已提交
3403
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3404
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3405
        public async Task TestErrorType4()
3406
        {
3407 3408
            await TestInMethodAsync(
@"var $$v1 = &(x => x);",
3409
                MainDescription($"({FeaturesResources.local_variable}) ?* v1"));
3410 3411
        }

J
Jared Parsons 已提交
3412
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3413
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3414
        public async Task TestErrorType5()
3415
        {
C
Cyrus Najmabadi 已提交
3416
            await TestInMethodAsync("var $$v1 = &v1",
3417
                MainDescription($"({FeaturesResources.local_variable}) var* v1"));
3418 3419
        }

J
Jared Parsons 已提交
3420
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3421
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3422
        public async Task TestErrorType6()
3423
        {
C
Cyrus Najmabadi 已提交
3424
            await TestInMethodAsync("var $$v1 = new Foo[1]",
3425
                MainDescription($"({FeaturesResources.local_variable}) Foo[] v1"));
3426 3427
        }

J
Jared Parsons 已提交
3428
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3429
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3430
        public async Task TestErrorType7()
3431
        {
3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443
            await TestInClassAsync(
@"class C
{
    void Method()
    {
    }

    void Foo()
    {
        var $$v1 = MethodGroup;
    }
}",
3444
                MainDescription($"({FeaturesResources.local_variable}) ? v1"));
3445 3446
        }

J
Jared Parsons 已提交
3447
        [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")]
3448
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3449
        public async Task TestErrorType8()
3450
        {
C
Cyrus Najmabadi 已提交
3451
            await TestInMethodAsync("var $$v1 = Unknown",
3452
                MainDescription($"({FeaturesResources.local_variable}) ? v1"));
3453 3454
        }

J
Jared Parsons 已提交
3455
        [WorkItem(545072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545072")]
3456
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3457
        public async Task TestDelegateSpecialTypes()
3458
        {
C
CyrusNajmabadi 已提交
3459 3460
            await TestAsync(
@"delegate void $$F(int x);",
3461 3462 3463
                MainDescription("delegate void F(int x)"));
        }

J
Jared Parsons 已提交
3464
        [WorkItem(545108, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545108")]
3465
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3466
        public async Task TestNullPointerParameter()
3467
        {
C
CyrusNajmabadi 已提交
3468 3469 3470 3471 3472 3473 3474
            await TestAsync(
@"class C
{
    unsafe void $$Foo(int* x = null)
    {
    }
}",
3475 3476 3477
                MainDescription("void C.Foo([int* x = null])"));
        }

J
Jared Parsons 已提交
3478
        [WorkItem(545098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545098")]
3479
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3480
        public async Task TestLetIdentifier1()
3481
        {
C
Cyrus Najmabadi 已提交
3482
            await TestInMethodAsync("var q = from e in \"\" let $$y = 1 let a = new { y } select a;",
3483
                MainDescription($"({FeaturesResources.range_variable}) int y"));
3484 3485
        }

J
Jared Parsons 已提交
3486
        [WorkItem(545295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545295")]
3487
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3488
        public async Task TestNullableDefaultValue()
3489
        {
C
CyrusNajmabadi 已提交
3490 3491 3492 3493 3494 3495 3496
            await TestAsync(
@"class Test
{
    void $$Method(int? t1 = null)
    {
    }
}",
3497 3498 3499
                MainDescription("void Test.Method([int? t1 = null])"));
        }

J
Jared Parsons 已提交
3500
        [WorkItem(529586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529586")]
3501
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3502
        public async Task TestInvalidParameterInitializer()
3503
        {
C
Cyrus Najmabadi 已提交
3504
            await TestAsync(
C
CyrusNajmabadi 已提交
3505 3506 3507 3508 3509 3510 3511 3512
@"class Program
{
    void M1(float $$j1 = ""Hello""
+
""World"")
    {
    }
}",
3513
                MainDescription($@"({FeaturesResources.parameter}) float j1 = ""Hello"" + ""World"""));
3514 3515
        }

J
Jared Parsons 已提交
3516
        [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")]
3517
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3518
        public async Task TestComplexConstLocal()
3519
        {
C
Cyrus Najmabadi 已提交
3520
            await TestAsync(
3521 3522 3523 3524 3525 3526 3527 3528
@"class Program
{
    void Main()
    {
        const int MEGABYTE = 1024 *
            1024 + true;
        Blah($$MEGABYTE);
    }
C
CyrusNajmabadi 已提交
3529
}",
3530
                MainDescription($@"({FeaturesResources.local_constant}) int MEGABYTE = 1024 * 1024 + true"));
3531 3532
        }

J
Jared Parsons 已提交
3533
        [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")]
3534
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3535
        public async Task TestComplexConstField()
3536
        {
C
Cyrus Najmabadi 已提交
3537
            await TestAsync(
3538 3539
@"class Program
{
C
CyrusNajmabadi 已提交
3540 3541
    const int a = true
        -
3542
        false;
C
CyrusNajmabadi 已提交
3543

3544 3545 3546 3547 3548
    void Main()
    {
        Foo($$a);
    }
}",
3549
                MainDescription($"({FeaturesResources.constant}) int Program.a = true - false"));
3550 3551
        }

3552
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3553
        public async Task TestTypeParameterCrefDoesNotHaveQuickInfo()
3554
        {
C
Cyrus Najmabadi 已提交
3555
            await TestAsync(
3556 3557 3558 3559 3560 3561 3562 3563 3564
@"class C<T>
{
    ///  <see cref=""C{X$$}""/>
    static void Main(string[] args)
    {
    }
}");
        }

3565
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3566
        public async Task TestCref1()
3567
        {
C
Cyrus Najmabadi 已提交
3568
            await TestAsync(
3569 3570 3571 3572 3573 3574 3575 3576 3577 3578
@"class Program
{
    ///  <see cref=""Mai$$n""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

3579
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3580
        public async Task TestCref2()
3581
        {
C
Cyrus Najmabadi 已提交
3582
            await TestAsync(
3583 3584 3585 3586 3587 3588 3589 3590 3591 3592
@"class Program
{
    ///  <see cref=""$$Main""/>
    static void Main(string[] args)
    {
    }
}",
                MainDescription(@"void Program.Main(string[] args)"));
        }

3593
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3594
        public async Task TestCref3()
3595
        {
C
Cyrus Najmabadi 已提交
3596
            await TestAsync(
3597 3598 3599 3600 3601 3602 3603 3604 3605
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

3606
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3607
        public async Task TestCref4()
3608
        {
C
Cyrus Najmabadi 已提交
3609
            await TestAsync(
3610 3611 3612 3613 3614 3615 3616 3617 3618
@"class Program
{
    ///  <see cref=""Main$$""/>
    static void Main(string[] args)
    {
    }
}");
        }

3619
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3620
        public async Task TestCref5()
3621
        {
C
Cyrus Najmabadi 已提交
3622
            await TestAsync(
3623 3624 3625 3626 3627 3628 3629 3630 3631
@"class Program
{
    ///  <see cref=""Main""$$/>
    static void Main(string[] args)
    {
    }
}");
        }

J
Jared Parsons 已提交
3632
        [WorkItem(546849, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546849")]
3633
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3634
        public async Task TestIndexedProperty()
3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671
        {
            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 已提交
3672
            await TestWithReferenceAsync(sourceCode: markup,
3673 3674 3675 3676 3677 3678
                referencedCode: referencedCode,
                sourceLanguage: LanguageNames.CSharp,
                referencedLanguage: LanguageNames.VisualBasic,
                expectedResults: MainDescription("string CCC.IndexProp[int p1, [int p2 = 0]] { get; set; }"));
        }

J
Jared Parsons 已提交
3679
        [WorkItem(546918, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546918")]
3680
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3681
        public async Task TestUnconstructedGeneric()
3682
        {
C
Cyrus Najmabadi 已提交
3683
            await TestAsync(
C
CyrusNajmabadi 已提交
3684 3685 3686 3687
@"class A<T>
{
    enum SortOrder
    {
3688 3689 3690 3691
        Ascending,
        Descending,
        None
    }
C
CyrusNajmabadi 已提交
3692 3693 3694

    void Foo()
    {
3695 3696 3697 3698 3699 3700
        var b = $$SortOrder.Ascending;
    }
}",
                MainDescription(@"enum A<T>.SortOrder"));
        }

J
Jared Parsons 已提交
3701
        [WorkItem(546970, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546970")]
3702
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3703
        public async Task TestUnconstructedGenericInCRef()
3704
        {
C
Cyrus Najmabadi 已提交
3705
            await TestAsync(
C
CyrusNajmabadi 已提交
3706 3707 3708 3709
@"/// <see cref=""$$C{T}"" />
class C<T>
{
}",
3710 3711 3712
                MainDescription(@"class C<T>"));
        }

3713
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3714
        public async Task TestAwaitableMethod()
3715 3716 3717 3718 3719 3720 3721 3722 3723
        {
            var markup = @"using System.Threading.Tasks;
class C
{
    async Task Foo()
    {
        Fo$$o();
    }
}";
3724
            var description = $"({CSharpFeaturesResources.awaitable}) Task C.Foo()";
3725

3726
            var documentation = $@"
3727
{WorkspacesResources.Usage_colon}
R
Ravi Chande 已提交
3728
  {SyntaxFacts.GetText(SyntaxKind.AwaitKeyword)} Foo();";
3729

C
Cyrus Najmabadi 已提交
3730
            await VerifyWithMscorlib45Async(markup, new[] { MainDescription(description), Usage(documentation) });
3731 3732
        }

3733
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3734
        public async Task ObsoleteItem()
3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746
        {
            var markup = @"
using System;

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

J
Jared Parsons 已提交
3750
        [WorkItem(751070, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751070")]
3751
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3752
        public async Task DynamicOperator()
3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767
        {
            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 已提交
3768
            await TestAsync(markup, MainDescription("dynamic dynamic.operator ==(dynamic left, dynamic right)"));
3769 3770
        }

3771
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3772
        public async Task TextOnlyDocComment()
3773
        {
C
CyrusNajmabadi 已提交
3774 3775
            await TestAsync(
@"/// <summary>
3776 3777 3778 3779 3780 3781 3782
///foo
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

3783
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3784
        public async Task TestTrimConcatMultiLine()
3785
        {
C
CyrusNajmabadi 已提交
3786 3787
            await TestAsync(
@"/// <summary>
3788 3789 3790 3791 3792 3793 3794 3795
/// foo
/// bar
/// </summary>
class C$$
{
}", Documentation("foo bar"));
        }

3796
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3797
        public async Task TestCref()
3798
        {
C
CyrusNajmabadi 已提交
3799 3800
            await TestAsync(
@"/// <summary>
3801 3802 3803 3804 3805 3806 3807 3808
/// <see cref=""C""/>
/// <seealso cref=""C""/>
/// </summary>
class C$$
{
}", Documentation("C C"));
        }

3809
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3810
        public async Task ExcludeTextOutsideSummaryBlock()
3811
        {
C
CyrusNajmabadi 已提交
3812 3813
            await TestAsync(
@"/// red
3814 3815 3816 3817 3818 3819 3820 3821 3822
/// <summary>
/// green
/// </summary>
/// yellow
class C$$
{
}", Documentation("green"));
        }

3823
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3824
        public async Task NewlineAfterPara()
3825
        {
C
CyrusNajmabadi 已提交
3826 3827
            await TestAsync(
@"/// <summary>
3828 3829 3830 3831 3832 3833 3834
/// <para>foo</para>
/// </summary>
class C$$
{
}", Documentation("foo"));
        }

3835
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3836
        public async Task TextOnlyDocComment_Metadata()
3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853
        {
            var referenced = @"
/// <summary>
///foo
/// </summary>
public class C
{
}";

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

3857
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3858
        public async Task TestTrimConcatMultiLine_Metadata()
3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876
        {
            var referenced = @"
/// <summary>
/// foo
/// bar
/// </summary>
public class C
{
}";

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

3880
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3881
        public async Task TestCref_Metadata()
3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898
        {
            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";

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

3902
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3903
        public async Task ExcludeTextOutsideSummaryBlock_Metadata()
3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922
        {
            var code = @"
class G
{
    void foo()
    {
        C$$ c;
    }
}";

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

3926
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3927
        public async Task Param()
3928
        {
C
CyrusNajmabadi 已提交
3929 3930
            await TestAsync(
@"/// <summary></summary>
3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T>(string[] arg$$s, T otherParam)
    {
    }
}", Documentation("First parameter of C.Foo<T>(string[], T)"));
        }

3942
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3943
        public async Task Param_Metadata()
3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964
        {
            var code = @"
class G
{
    void foo()
    {
        C c;
        c.Foo<int>(arg$$s: new string[] { }, 1);
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T>(string[] args, T otherParam)
    {
    }
}";
C
Cyrus Najmabadi 已提交
3965
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("First parameter of C.Foo<T>(string[], T)"));
3966 3967
        }

3968
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3969
        public async Task Param2()
3970
        {
C
CyrusNajmabadi 已提交
3971 3972
            await TestAsync(
@"/// <summary></summary>
3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T>(string[] args, T oth$$erParam)
    {
    }
}", Documentation("Another parameter of C.Foo<T>(string[], T)"));
        }

3984
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
3985
        public async Task Param2_Metadata()
3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002
        {
            var code = @"
class G
{
    void foo()
    {
        C c;
        c.Foo<int>(args: new string[] { }, other$$Param: 1);
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{ T} (string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
C
Cyrus Najmabadi 已提交
4003
    public void Foo<T>(string[] args, T otherParam)
4004 4005 4006
    {
    }
}";
C
Cyrus Najmabadi 已提交
4007
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("Another parameter of C.Foo<T>(string[], T)"));
4008 4009
        }

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

4026
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4027
        public async Task UnboundCref()
4028
        {
C
CyrusNajmabadi 已提交
4029 4030
            await TestAsync(
@"/// <summary></summary>
4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041
public class C
{
    /// <typeparam name=""T"">A type parameter of <see cref=""foo{T}(string[], T)""/></typeparam>
    /// <param name=""args"">First parameter of <see cref=""Foo{T} (string[], T)""/></param>
    /// <param name=""otherParam"">Another parameter of <see cref=""Foo{T}(string[], T)""/></param>
    public void Foo<T$$>(string[] args, T otherParam)
    {
    }
}", Documentation("A type parameter of foo<T>(string[], T)"));
        }

4042
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4043
        public async Task CrefInConstructor()
4044
        {
C
CyrusNajmabadi 已提交
4045 4046
            await TestAsync(
@"public class TestClass
4047 4048 4049 4050 4051 4052 4053 4054 4055 4056
{
    /// <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."));
        }

4057
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4058
        public async Task CrefInConstructorOverloaded()
4059
        {
C
CyrusNajmabadi 已提交
4060 4061
            await TestAsync(
@"public class TestClass
4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073
{
    /// <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 已提交
4074 4075 4076
    {
    }
}", Documentation("This sample shows how to specify the TestClass(int) constructor as a cref attribute."));
4077 4078
        }

4079
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4080
        public async Task CrefInGenericMethod1()
4081
        {
C
CyrusNajmabadi 已提交
4082 4083
            await TestAsync(
@"public class TestClass
4084
{
C
CyrusNajmabadi 已提交
4085 4086 4087 4088 4089 4090 4091 4092 4093
    /// <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."));
4094 4095
        }

4096
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4097
        public async Task CrefInGenericMethod2()
4098
        {
C
CyrusNajmabadi 已提交
4099 4100
            await TestAsync(
@"public class TestClass
4101
{
C
CyrusNajmabadi 已提交
4102 4103 4104 4105 4106 4107 4108 4109 4110
    /// <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."));
4111 4112
        }

J
Jared Parsons 已提交
4113
        [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")]
4114
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4115
        public async Task CrefInMethodOverloading1()
4116
        {
C
CyrusNajmabadi 已提交
4117 4118
            await TestAsync(
@"public class TestClass
4119
{
C
CyrusNajmabadi 已提交
4120 4121 4122 4123 4124
    public static int GetZero()
    {
        GetGenericValu$$e();
        GetGenericValue(5);
    }
4125

C
CyrusNajmabadi 已提交
4126 4127 4128 4129 4130 4131 4132
    /// <summary> 
    /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
    /// </summary> 
    public static T GetGenericValue<T>(T para)
    {
        return para;
    }
4133

C
CyrusNajmabadi 已提交
4134 4135 4136 4137 4138 4139 4140
    /// <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."));
4141 4142
        }

J
Jared Parsons 已提交
4143
        [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")]
4144
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4145
        public async Task CrefInMethodOverloading2()
4146
        {
C
CyrusNajmabadi 已提交
4147 4148
            await TestAsync(
@"public class TestClass
4149
{
C
CyrusNajmabadi 已提交
4150 4151 4152 4153 4154
    public static int GetZero()
    {
        GetGenericValue();
        GetGenericVal$$ue(5);
    }
4155

C
CyrusNajmabadi 已提交
4156 4157 4158 4159 4160 4161 4162
    /// <summary> 
    /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method
    /// </summary> 
    public static T GetGenericValue<T>(T para)
    {
        return para;
    }
4163

C
CyrusNajmabadi 已提交
4164 4165 4166 4167 4168 4169 4170
    /// <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"));
4171 4172
        }

4173
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4174
        public async Task CrefInGenericType()
4175
        {
C
CyrusNajmabadi 已提交
4176 4177 4178 4179 4180 4181 4182
            await TestAsync(
@"/// <summary> 
/// <remarks>This example shows how to specify the <see cref=""GenericClass{T}""/> cref.</remarks>
/// </summary> 
class Generic$$Class<T>
{
}",
4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194
    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 已提交
4195
        [WorkItem(812720, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/812720")]
4196
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4197
        public async Task ClassificationOfCrefsFromMetadata()
4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218
        {
            var code = @"
class G
{
    void foo()
    {
        C c;
        c.Fo$$o();
    }
}";
            var referenced = @"
/// <summary></summary>
public class C
{
    /// <summary> 
    /// See <see cref=""Foo""/> method
    /// </summary> 
    public void Foo()
    {
    }
}";
C
Cyrus Najmabadi 已提交
4219
            await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#",
4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232
                Documentation("See C.Foo() method",
                    ExpectedClassifications(
                        Text("See"),
                        WhiteSpace(" "),
                        Class("C"),
                        Punctuation.Text("."),
                        Identifier("Foo"),
                        Punctuation.OpenParen,
                        Punctuation.CloseParen,
                        WhiteSpace(" "),
                        Text("method"))));
        }

4233
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4234
        public async Task FieldAvailableInBothLinkedFiles()
4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    int x;
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";

4255
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.field}) int C.x"), Usage("") });
4256 4257
        }

4258
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4259
        public async Task FieldUnavailableInOneLinkedFile()
4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""FOO"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
4281
            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);
4282

C
Cyrus Najmabadi 已提交
4283
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4284 4285
        }

4286
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4287
        public async Task BindSymbolInOtherFile()
4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""FOO"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
4309
            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);
4310

C
Cyrus Najmabadi 已提交
4311
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4312 4313
        }

4314
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4315
        public async Task FieldUnavailableInTwoLinkedFiles()
4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""FOO"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif
    void foo()
    {
        x$$
    }
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
            var expectedDescription = Usage(
4341
                $"\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}",
4342 4343
                expectsWarningGlyph: true);

C
Cyrus Najmabadi 已提交
4344
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4345 4346
        }

4347
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4348
        public async Task ExcludeFilesWithInactiveRegions()
4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""FOO,BAR"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
#if FOO
    int x;
#endif

#if BAR
    void foo()
    {
        x$$
    }
#endif
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument"" />
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3"" PreprocessorSymbols=""BAR"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
4376
            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 已提交
4377
            await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription });
4378 4379
        }

J
Jared Parsons 已提交
4380
        [WorkItem(962353, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/962353")]
4381
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4382
        public async Task NoValidSymbolsInLinkedDocuments()
4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404
        {
            var markup = @"<Workspace>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
        <Document FilePath=""SourceDocument""><![CDATA[
class C
{
    void foo()
    {
        B$$ar();
    }
#if B
    void Bar() { }
#endif
   
}
]]>
        </Document>
    </Project>
    <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"">
        <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/>
    </Project>
</Workspace>";
C
Cyrus Najmabadi 已提交
4405
            await VerifyWithReferenceWorkerAsync(markup);
4406 4407
        }

J
Jared Parsons 已提交
4408
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4409
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4410
        public async Task LocalsValidInLinkedDocuments()
4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429
        {
            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>";

4430
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage("") });
4431 4432
        }

J
Jared Parsons 已提交
4433
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4434
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4435
        public async Task LocalWarningInLinkedDocuments()
4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458
        {
            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>";

4459
            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) });
4460 4461
        }

J
Jared Parsons 已提交
4462
        [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")]
4463
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4464
        public async Task LabelsValidInLinkedDocuments()
4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483
        {
            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>";

4484
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.label}) LABEL"), Usage("") });
4485 4486
        }

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

4510
            await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.range_variable}) int y"), Usage("") });
4511 4512
        }

J
Jared Parsons 已提交
4513
        [WorkItem(1019766, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1019766")]
4514
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4515
        public async Task PointerAccessibility()
4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526
        {
            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 已提交
4527
            await TestAsync(markup, MainDescription("bool void*.operator ==(void* left, void* right)"));
4528 4529
        }

J
Jared Parsons 已提交
4530
        [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")]
4531
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4532
        public async Task AwaitingTaskOfArrayType()
4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543
        {
            var markup = @"
using System.Threading.Tasks;

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

J
Jared Parsons 已提交
4547
        [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")]
4548
        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
C
Cyrus Najmabadi 已提交
4549
        public async Task AwaitingTaskOfDynamic()
4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560
        {
            var markup = @"
using System.Threading.Tasks;

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

4564
        [Fact, Trait(Traits.Feature, Traits.Features.Completion)]
C
Cyrus Najmabadi 已提交
4565
        public async Task MethodOverloadDifferencesIgnored()
4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590
        {
            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 已提交
4591
            await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription));
4592
        }
4593

4594
        [Fact, Trait(Traits.Feature, Traits.Features.Completion)]
C
Cyrus Najmabadi 已提交
4595
        public async Task MethodOverloadDifferencesIgnored_ContainingType()
4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643
        {
            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 已提交
4644
            await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription));
4645
        }
4646 4647 4648

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

4654 4655
namespace MyNs
{
C
CyrusNajmabadi 已提交
4656 4657 4658 4659 4660 4661 4662 4663
    class MyException1 : Exception
    {
    }

    class MyException2 : Exception
    {
    }

4664 4665 4666 4667 4668 4669
    class TestClass
    {
        /// <exception cref=""MyException1""></exception>
        /// <exception cref=""T:MyNs.MyException2""></exception>
        /// <exception cref=""System.Int32""></exception>
        /// <exception cref=""double""></exception>
4670
        /// <exception cref=""Not_A_Class_But_Still_Displayed""></exception>
4671 4672 4673 4674 4675
        void M()
        {
            M$$();
        }
    }
C
CyrusNajmabadi 已提交
4676
}",
4677
                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"));
4678
        }
4679 4680 4681

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(1516, "https://github.com/dotnet/roslyn/issues/1516")]
C
Cyrus Najmabadi 已提交
4682
        public async Task QuickInfoWithNonStandardSeeAttributesAppear()
4683
        {
C
CyrusNajmabadi 已提交
4684 4685
            await TestAsync(
@"class C
4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696
{
    /// <summary>
    /// <see cref=""System.String"" />
    /// <see href=""http://microsoft.com"" />
    /// <see langword=""null"" />
    /// <see unsupported-attribute=""cat"" />
    /// </summary>
    void M()
    {
        M$$();
    }
C
CyrusNajmabadi 已提交
4697
}",
4698 4699
                Documentation(@"string http://microsoft.com null cat"));
        }
4700 4701 4702

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        [WorkItem(6657, "https://github.com/dotnet/roslyn/issues/6657")]
4703
        public async Task OptionalParameterFromPreviousSubmission()
4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714
        {
            const string workspaceDefinition = @"
<Workspace>
    <Submission Language=""C#"" CommonReferences=""true"">
        void M(int x = 1) { }
    </Submission>
    <Submission Language=""C#"" CommonReferences=""true"">
        M(x$$: 2)
    </Submission>
</Workspace>
";
C
Cyrus Najmabadi 已提交
4715
            using (var workspace = await TestWorkspace.CreateAsync(XElement.Parse(workspaceDefinition), workspaceKind: WorkspaceKind.Interactive))
4716
            {
4717
                await TestWithOptionsAsync(workspace, MainDescription("(parameter) int x = 1"));
4718 4719
            }
        }
C
CyrusNajmabadi 已提交
4720 4721 4722 4723

        [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)]
        public async Task TupleProperty()
        {
4724 4725
            await TestInMethodAsync(
@"interface I
C
CyrusNajmabadi 已提交
4726 4727 4728
{
    (int, int) Name { get; set; }
}
4729

C
CyrusNajmabadi 已提交
4730 4731 4732 4733
class C : I
{
    (int, int) I.Name$$
    {
4734 4735 4736 4737 4738 4739 4740 4741
        get
        {
            throw new System.Exception();
        }

        set
        {
        }
C
CyrusNajmabadi 已提交
4742 4743 4744 4745
    }
}",
                MainDescription("(int, int) C.Name { get; set; }"));
        }
4746
    }
C
Cyrus Najmabadi 已提交
4747
}