-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for F1 help (#18406)
Add integration tests for F1 help
- Loading branch information
Ravi Chande
authored
Apr 6, 2017
1 parent
9616765
commit 82110f4
Showing
5 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpF1Help.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.CodeAnalysis; | ||
using Microsoft.VisualStudio.IntegrationTest.Utilities; | ||
using Roslyn.Test.Utilities; | ||
using Xunit; | ||
|
||
namespace Roslyn.VisualStudio.IntegrationTests.CSharp | ||
{ | ||
[Collection(nameof(SharedIntegrationHostFixture))] | ||
public class CSharpF1Help : AbstractEditorTest | ||
{ | ||
protected override string LanguageName => LanguageNames.CSharp; | ||
|
||
public CSharpF1Help(VisualStudioInstanceFactory instanceFactory) | ||
: base(instanceFactory, nameof(CSharpF1Help)) | ||
{ | ||
} | ||
|
||
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)] | ||
void F1Help() | ||
{ | ||
var text = @" | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
namespace F1TestNamespace | ||
{ | ||
#region TaoRegion | ||
abstract class ShapesClass { } | ||
class Program$$ | ||
{ | ||
public static void Main() | ||
{ | ||
} | ||
public IEnumerable<int> Linq1() | ||
{ | ||
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; | ||
int i = numbers.First(); | ||
int j = Array.IndexOf(numbers, 1); | ||
var lowNums1 = | ||
from n in numbers | ||
orderby n ascending | ||
where n < 5 | ||
select n; | ||
var numberGroups = | ||
from n in numbers | ||
let m = 1 | ||
join p in numbers on i equals p | ||
group n by n % 5 into g | ||
select new { Remainder = g.Key, Numbers = g }; | ||
foreach (int element in numbers) yield return i; | ||
} | ||
} | ||
#endregion TaoRegion | ||
}"; | ||
|
||
SetUpEditor(text); | ||
Verify("abstract", "abstract_CSharpKeyword"); | ||
Verify("ascending", "ascending_CSharpKeyword"); | ||
Verify("from", "from_CSharpKeyword"); | ||
Verify("First();", "System.Linq.Enumerable.First``1"); | ||
} | ||
|
||
private void Verify(string word, string expectedKeyword) | ||
{ | ||
VisualStudio.Editor.PlaceCaret(word, charsOffset: -1); | ||
Assert.Contains(expectedKeyword, VisualStudio.Editor.GetF1Keyword()); | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicF1Help.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.CodeAnalysis; | ||
using Microsoft.VisualStudio.IntegrationTest.Utilities; | ||
using Roslyn.Test.Utilities; | ||
using Xunit; | ||
|
||
namespace Roslyn.VisualStudio.IntegrationTests.Basic | ||
{ | ||
[Collection(nameof(SharedIntegrationHostFixture))] | ||
public class BasicF1Help : AbstractEditorTest | ||
{ | ||
protected override string LanguageName => LanguageNames.VisualBasic; | ||
|
||
public BasicF1Help(VisualStudioInstanceFactory instanceFactory) | ||
: base(instanceFactory, nameof(BasicF1Help)) | ||
{ | ||
} | ||
|
||
[Fact, Trait(Traits.Feature, Traits.Features.F1Help)] | ||
void F1Help() | ||
{ | ||
var text = @" | ||
Imports System | ||
Imports System.Collections.Generic | ||
Imports System.Linq | ||
Module Program$$ | ||
Sub Main(args As String()) | ||
Dim query = From arg In args | ||
Select args.Any(Function(a) a.Length > 5) | ||
Dim x = 0 | ||
x += 1 | ||
End Sub | ||
Public Function F() As Object | ||
Return Nothing | ||
End Function | ||
End Module"; | ||
|
||
SetUpEditor(text); | ||
Verify("Linq", "System.Linq"); | ||
Verify("String", "vb.String"); | ||
Verify("Any", "System.Linq.Enumerable.Any"); | ||
Verify("From", "vb.QueryFrom"); | ||
Verify("+=", "vb.+="); | ||
Verify("Nothing", "vb.Nothing"); | ||
|
||
} | ||
|
||
private void Verify(string word, string expectedKeyword) | ||
{ | ||
VisualStudio.Editor.PlaceCaret(word, charsOffset: -1); | ||
Assert.Contains(expectedKeyword, VisualStudio.Editor.GetF1Keyword()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters