-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
Copy pathF1HelpTests.cs
1790 lines (1615 loc) · 41.9 KB
/
F1HelpTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService;
using Microsoft.VisualStudio.LanguageServices.Implementation.F1Help;
using Microsoft.VisualStudio.LanguageServices.UnitTests;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.F1Help
{
[UseExportProvider]
public class F1HelpTests
{
private static async Task TestAsync(string markup, string expectedText)
{
using var workspace = TestWorkspace.CreateCSharp(markup, composition: VisualStudioTestCompositions.LanguageServices);
var caret = workspace.Documents.First().CursorPosition;
var service = Assert.IsType<CSharpHelpContextService>(workspace.Services.GetLanguageServices(LanguageNames.CSharp).GetService<IHelpContextService>());
var actualText = await service.GetHelpTermAsync(workspace.CurrentSolution.Projects.First().Documents.First(), workspace.Documents.First().SelectedSpans.First(), CancellationToken.None);
Assert.Equal(expectedText, actualText);
}
private static async Task Test_KeywordAsync(string markup, string expectedText)
{
await TestAsync(markup, expectedText + "_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestInternal()
{
await Test_KeywordAsync(
@"intern[||]al class C
{
}", "internal");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestProtected()
{
await Test_KeywordAsync(
@"public class C
{
protec[||]ted void goo();
}", "protected");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestProtectedInternal1()
{
await Test_KeywordAsync(
@"public class C
{
internal protec[||]ted void goo();
}", "protectedinternal");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestProtectedInternal2()
{
await Test_KeywordAsync(
@"public class C
{
protec[||]ted internal void goo();
}", "protectedinternal");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPrivateProtected1()
{
await Test_KeywordAsync(
@"public class C
{
private protec[||]ted void goo();
}", "privateprotected");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPrivateProtected2()
{
await Test_KeywordAsync(
@"public class C
{
priv[||]ate protected void goo();
}", "privateprotected");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPrivateProtected3()
{
await Test_KeywordAsync(
@"public class C
{
protected priv[||]ate void goo();
}", "privateprotected");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPrivateProtected4()
{
await Test_KeywordAsync(
@"public class C
{
prot[||]ected private void goo();
}", "privateprotected");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestModifierSoup()
{
await Test_KeywordAsync(
@"public class C
{
private new prot[||]ected static unsafe void foo()
{
}
}", "privateprotected");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestModifierSoupField()
{
await Test_KeywordAsync(
@"public class C
{
new prot[||]ected static unsafe private goo;
}", "privateprotected");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestVoid()
{
await Test_KeywordAsync(
@"class C
{
vo[||]id goo()
{
}
}", "void");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestReturn()
{
await Test_KeywordAsync(
@"class C
{
void goo()
{
ret[||]urn;
}
}", "return");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestClassPartialType()
{
await Test_KeywordAsync(
@"part[||]ial class C
{
partial void goo();
}", "partialtype");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestRecordPartialType()
{
await Test_KeywordAsync(
@"part[||]ial record C
{
partial void goo();
}", "partialtype");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestRecordWithPrimaryConstructorPartialType()
{
await Test_KeywordAsync(
@"part[||]ial record C(string S)
{
partial void goo();
}", "partialtype");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPartialMethodInClass()
{
await Test_KeywordAsync(
@"partial class C
{
par[||]tial void goo();
}", "partialmethod");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPartialMethodInRecord()
{
await Test_KeywordAsync(
@"partial record C
{
par[||]tial void goo();
}", "partialmethod");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestExtendedPartialMethod()
{
await Test_KeywordAsync(
@"partial class C
{
public par[||]tial void goo();
}", "partialmethod");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestWhereClause()
{
await Test_KeywordAsync(
@"using System.Linq;
class Program<T> where T : class
{
void goo(string[] args)
{
var x = from a in args
whe[||]re a.Length > 0
select a;
}
}", "whereclause");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestWhereConstraint()
{
await Test_KeywordAsync(
@"using System.Linq;
class Program<T> wh[||]ere T : class
{
void goo(string[] args)
{
var x = from a in args
where a.Length > 0
select a;
}
}", "whereconstraint");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPreprocessor()
{
await TestAsync(
@"#regi[||]on
#endregion", "#region");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestConstructor()
{
await TestAsync(
@"namespace N
{
class C
{
void goo()
{
var x = new [|C|]();
}
}
}", "N.C.#ctor");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestGenericClass()
{
await TestAsync(
@"namespace N
{
class C<T>
{
void goo()
{
[|C|]<int> c;
}
}
}", "N.C`1");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestGenericMethod()
{
await TestAsync(
@"namespace N
{
class C<T>
{
void goo<T, U, V>(T t, U u, V v)
{
C<int> c;
c.g[|oo|](1, 1, 1);
}
}
}", "N.C`1.goo``3");
}
[Theory, Trait(Traits.Feature, Traits.Features.F1Help)]
[InlineData("+")]
[InlineData("-")]
[InlineData("&")]
[InlineData("|")]
[InlineData("/")]
[InlineData("^")]
[InlineData(">")]
[InlineData(">=")]
[InlineData("!=")]
[InlineData("<")]
[InlineData("<=")]
[InlineData("<<")]
[InlineData(">>")]
[InlineData(">>>")]
[InlineData("*")]
[InlineData("%")]
[InlineData("&&")]
[InlineData("||")]
[InlineData("==")]
public async Task TestBinaryOperator(string operatorText)
{
await TestAsync(
$@"namespace N
{{
class C
{{
void goo()
{{
var two = 1 [|{operatorText}|] 1;
}}
}}
}}", $"{operatorText}_CSharpKeyword");
}
[Theory, Trait(Traits.Feature, Traits.Features.F1Help)]
[InlineData("+=")]
[InlineData("-=")]
[InlineData("/=")]
[InlineData("*=")]
[InlineData("%=")]
[InlineData("&=")]
[InlineData("|=")]
[InlineData("^=")]
[InlineData("<<=")]
[InlineData(">>=")]
[InlineData(">>>=")]
public async Task TestCompoundOperator(string operatorText)
{
await TestAsync(
$@"namespace N
{{
class C
{{
void goo(int x)
{{
x [|{operatorText}|] x;
}}
}}
}}", $"{operatorText}_CSharpKeyword");
}
[Theory, Trait(Traits.Feature, Traits.Features.F1Help)]
[InlineData("++")]
[InlineData("--")]
[InlineData("!")]
[InlineData("~")]
public async Task TestPrefixOperator(string operatorText)
{
await TestAsync(
$@"namespace N
{{
class C
{{
void goo(int x)
{{
x = [|{operatorText}|]x;
}}
}}
}}", $"{operatorText}_CSharpKeyword");
}
[Theory, Trait(Traits.Feature, Traits.Features.F1Help)]
[InlineData("++")]
[InlineData("--")]
public async Task TestPostfixOperator(string operatorText)
{
await TestAsync(
$@"namespace N
{{
class C
{{
void goo(int x)
{{
x = x[|{operatorText}|];
}}
}}
}}", $"{operatorText}_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestRelationalPattern()
{
await TestAsync(
@"namespace N
{
class C
{
void goo(string x)
{
if (x is { Length: [||]> 5 }) { }
}
}
}", ">_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestGreaterThanInFunctionPointer()
{
await TestAsync(@"
unsafe class C
{
delegate*[||]<int> f;
}
", "functionPointer_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestLessThanInFunctionPointer()
{
await TestAsync(@"
unsafe class C
{
delegate*[||]<int> f;
}
", "functionPointer_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsOperatorInParameter()
{
await TestAsync(
@"namespace N
{
class C
{
void goo(int x [|=|] 0)
{
}
}
}", "optionalParameter_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsOperatorInPropertyInitializer()
{
await TestAsync(
@"namespace N
{
class C
{
int P { get; } [|=|] 5;
}
}", "propertyInitializer_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestVar()
{
await TestAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
var[||] x = 3;
}
}", "var_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEquals()
{
await TestAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
var x =[||] 3;
}
}", "=_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsInEnum()
{
await TestAsync(
@"
enum E
{
A [||]= 1
}", "enum_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsInAttribute()
{
await TestAsync(
@"
using System;
[AttributeUsage(AttributeTargets.Class, Inherited [|=|] true)]
class MyAttribute : Attribute
{
}
", "attributeNamedArgument_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsInUsingAlias()
{
await TestAsync(
@"
using SC [||]= System.Console;
", "using_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsInAnonymousObjectMemberDeclarator()
{
await TestAsync(
@"
class C
{
void M()
{
var x = new { X [||]= 0 };
}
}
", "anonymousObject_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsInDocumentationComment()
{
await TestAsync(
@"
class C
{
/// <summary>
/// <a b[||]=""c"" />
/// </summary>
void M()
{
var x = new { X [||]= 0 };
}
}
", "see");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestEqualsInLet()
{
await TestAsync(
@"
class C
{
void M()
{
var y =
from x1 in x2
let x3 [||]= x4
select x5;
}
}
", "let_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestLetKeyword()
{
await TestAsync(
@"
class C
{
void M()
{
var y =
from x1 in x2
[||]let x3 = x4
select x5;
}
}
", "let_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestFromIn()
{
await TestAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
var x = from n i[||]n {
1}
select n
}
}", "from_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestProperty()
{
await TestAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
new UriBuilder().Fragm[||]ent;
}
}", "System.UriBuilder.Fragment");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestForeachIn()
{
await TestAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
foreach (var x in[||] {
1} )
{
}
}
}", "in_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestRegionDescription()
{
await TestAsync(
@"class Program
{
static void Main(string[] args)
{
#region Begin MyR[||]egion for testing
#endregion End
}
}", "#region");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestGenericAngle_LessThanToken_TypeArgument()
{
await TestAsync(
@"class Program
{
static void generic<T>(T t)
{
generic[||]<int>(0);
}
}", "generics_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestGenericAngle_GreaterThanToken_TypeArgument()
{
await TestAsync(
@"class Program
{
static void generic<T>(T t)
{
generic<int[|>|](0);
}
}", "generics_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestGenericAngle_LessThanToken_TypeParameter()
{
await TestAsync(
@"class Program
{
static void generic[|<|]T>(T t)
{
generic<int>(0);
}
}", "generics_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestGenericAngle_GreaterThanToken_TypeParameter()
{
await TestAsync(
@"class Program
{
static void generic<T[|>|](T t)
{
generic<int>(0);
}
}", "generics_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestLocalReferenceIsType()
{
await TestAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
int x;
x[||];
}
}", "System.Int32");
}
[WorkItem(864266, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/864266")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestConstantField()
{
await TestAsync(
@"class Program
{
static void Main(string[] args)
{
var i = int.Ma[||]xValue;
}
}", "System.Int32.MaxValue");
}
[WorkItem(862420, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/862420")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestParameter()
{
await TestAsync(
@"class Class2
{
void M1(int par[||]ameter) // 1
{
}
void M2()
{
int argument = 1;
M1(parameter: argument); // 2
}
}", "System.Int32");
}
[WorkItem(862420, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/862420")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestArgumentType()
{
await TestAsync(
@"class Class2
{
void M1(int pa[||]rameter) // 1
{
}
void M2()
{
int argument = 1;
M1(parameter: argument); // 2
}
}", "System.Int32");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestYieldReturn_OnYield()
{
await TestAsync(@"
using System.Collections.Generic;
public class C
{
public IEnumerable<int> M()
{
[|yield|] return 0;
}
}
", "yield_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestYieldReturn_OnReturn()
{
await TestAsync(@"
using System.Collections.Generic;
public class C
{
public IEnumerable<int> M()
{
yield [|return|] 0;
}
}
", "yield_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestYieldBreak_OnYield()
{
await TestAsync(@"
using System.Collections.Generic;
public class C
{
public IEnumerable<int> M()
{
[|yield|] break;
}
}
", "yield_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestYieldBreak_OnBreak()
{
await TestAsync(@"
using System.Collections.Generic;
public class C
{
public IEnumerable<int> M()
{
yield [|break|] 0;
}
}
", "yield_CSharpKeyword");
}
[WorkItem(862396, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/862396")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestNoToken()
{
await TestAsync(
@"class Program
{
static void Main(string[] args)
{
}
}[||]", "vs.texteditor");
}
[WorkItem(862328, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/862328")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestLiteral()
{
await TestAsync(
@"class Program
{
static void Main(string[] args)
{
Main(new string[] { ""fo[||]o"" });
}
}", "System.String");
}
[WorkItem(862478, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/862478")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestColonColon()
{
await TestAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
global:[||]:System.Console.Write("");
}
}", "::_CSharpKeyword");
}
[WorkItem(46986, "https://github.com/dotnet/roslyn/issues/46986")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestStringInterpolation()
{
await TestAsync(
@"using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine($[||]""Hello, {args[0]}"");
}
}", "$_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestUtf8String()
{
await TestAsync(
@"using System;
class Program
{
static void Main(string[] args)
{
var x = ""Hel[||]lo""u8;
}
}", "Utf8StringLiteral_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestRawString()
{
await TestAsync(
@"using System;
class Program
{
static void Main(string[] args)
{
var x = """"""Hel[||]lo"""""";
}
}", "RawStringLiteral_CSharpKeyword");
}
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestUtf8RawString()
{
await TestAsync(
@"using System;
class Program
{
static void Main(string[] args)
{
var x = """"""Hel[||]lo""""""u8;
}
}", "Utf8StringLiteral_CSharpKeyword");
}
[WorkItem(46986, "https://github.com/dotnet/roslyn/issues/46986")]
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestVerbatimString()
{
await TestAsync(
@"using System;
class Program
{