Skip to content

Commit

Permalink
fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed Aug 11, 2015
1 parent 3e81d56 commit b9cd005
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/OmniSharp.Tests/FindImplementationFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class SomeClass : Base$Class {}";
private async Task<IEnumerable<ISymbol>> FindImplementations(string source)
{
var workspace = TestHelpers.CreateSimpleWorkspace(source);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var request = CreateRequest(source);
var bufferFilter = new UpdateBufferFilter(workspace);
bufferFilter.OnActionExecuting(TestHelpers.CreateActionExecutingContext(request, controller));
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.Tests/FindReferencesFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private async Task<QuickFixResponse> FindUsages(string source, bool excludeDefin
private async Task<QuickFixResponse> FindUsages(Dictionary<string, string> sources, string currentFile, bool onlyThisFile, bool excludeDefinition = false)
{
var workspace = TestHelpers.CreateSimpleWorkspace(sources);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var request = CreateRequest(sources[currentFile], currentFile, excludeDefinition);
request.OnlyThisFile = onlyThisFile;
var bufferFilter = new UpdateBufferFilter(workspace);
Expand Down
4 changes: 2 additions & 2 deletions tests/OmniSharp.Tests/FindSymbolsFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ private string NestedMethod() {}
private async Task<QuickFixResponse> FindSymbols(string source)
{
var workspace = TestHelpers.CreateSimpleWorkspace(source);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
return await controller.FindSymbols();
}

private async Task<QuickFixResponse> FindSymbolsWithFilter(string source, string filter)
{
var workspace = TestHelpers.CreateSimpleWorkspace(source);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var request = new FindSymbolsRequest { Filter = filter };
return await controller.FindSymbols(request);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/OmniSharp.Tests/GoToFileFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void ReturnsAListOfAllWorkspaceFiles()
var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary<string, string> {
{ "foo.cs", source1 }, { "bar.cs", source2}
});
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var response = controller.GoToFile(new Request());

Assert.Equal(2, response.QuickFixes.Count());
Expand All @@ -29,7 +29,7 @@ public void ReturnsAListOfAllWorkspaceFiles()
public void ReturnsEmptyResponseForEmptyWorskpace()
{
var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary<string, string>());
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var response = controller.GoToFile(new Request());

Assert.Equal(0, response.QuickFixes.Count());
Expand Down
16 changes: 8 additions & 8 deletions tests/OmniSharp.Tests/HighlightFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class C1 { int n = true; }
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", Lines = new[] { 4 } });

AssertSyntax(regions.Highlights, code, 3,
Expand Down Expand Up @@ -54,7 +54,7 @@ class C1 { int n = true; }
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs" });

AssertSyntax(regions.Highlights, code, 0,
Expand Down Expand Up @@ -88,7 +88,7 @@ class C1
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs" });

AssertSyntax(regions.Highlights, code, 0,
Expand Down Expand Up @@ -160,7 +160,7 @@ class C1 { int n = true; }
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", ExcludeClassifications = new [] { HighlightClassification.Keyword } });

Assert.DoesNotContain(regions.Highlights, x => x.Kind == "keyword");
Expand All @@ -181,7 +181,7 @@ class C1 { int n = true; }
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", ExcludeClassifications = new [] { HighlightClassification.Punctuation } });

Assert.DoesNotContain(regions.Highlights, x => x.Kind == "punctuation");
Expand All @@ -202,7 +202,7 @@ class C1 { int n = true; }
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", ExcludeClassifications = new [] { HighlightClassification.Operator } });

Assert.DoesNotContain(regions.Highlights, x => x.Kind == "operator");
Expand All @@ -223,7 +223,7 @@ class C1 { int n = true; }
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", ExcludeClassifications = new [] { HighlightClassification.Identifier } });

Assert.DoesNotContain(regions.Highlights, x => x.Kind == "identifier");
Expand All @@ -244,7 +244,7 @@ class C1 { int n = true; }
{ "a.cs", code }
});

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", ExcludeClassifications = new [] { HighlightClassification.Name } });

Assert.DoesNotContain(regions.Highlights, x => x.Kind.EndsWith(" name"));
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.Tests/IntellisenseFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void ContainsCompletions(IEnumerable<string> completions, params string[
private async Task<IEnumerable<AutoCompleteResponse>> FindCompletionsAsync(string source, AutoCompleteRequest request = null)
{
var workspace = TestHelpers.CreateSimpleWorkspace(source);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());

if (request == null)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.Tests/NavigateUpDownFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ private async Task<NavigateResponse> SendRequest(OmnisharpWorkspace workspace, s
{
var initialCursorLineColumn = TestHelpers.GetLineAndColumnFromDollar(TestHelpers.RemovePercentMarker(fileContent));
var fileContentNoDollarMarker = TestHelpers.RemoveDollarMarker(fileContent);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var request = new Request
{
Line = initialCursorLineColumn.Line,
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.Tests/OmnisharpControllerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class OmnisharpControllerFacts
private void CreateSimpleWorkspace(out OmnisharpWorkspace workspace, out OmnisharpController controller, out DocumentInfo document, string filename, string contents)
{
workspace = new OmnisharpWorkspace();
controller = new OmnisharpController(workspace, null);
controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());

var projectInfo = ProjectInfo.Create(ProjectId.CreateNewId(), VersionStamp.Create(),
"ProjectNameVal", "AssemblyNameVal", LanguageNames.CSharp);
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.Tests/RenameFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class RenameFacts
private async Task<RenameResponse> SendRequest(OmnisharpWorkspace workspace, string renameTo, string filename, string fileContent, bool wantsTextChanges = false)
{
var lineColumn = TestHelpers.GetLineAndColumnFromDollar(fileContent);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var request = new RenameRequest
{
Line = lineColumn.Line,
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.Tests/SignatureHelpFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ private async Task<SignatureHelp> GetSignatureHelp(string source)
};

var workspace = TestHelpers.CreateSimpleWorkspace(source);
var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
return await controller.GetSignatureHelp(request);
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/OmniSharp.Tests/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ public static OmnisharpWorkspace CreateSimpleWorkspace(string source, string fil
public static OmnisharpWorkspace CreateSimpleWorkspace(Dictionary<string, string> sourceFiles)
{
var workspace = Startup.CreateWorkspace();
workspace.Options.WithChangedOption(FormattingOptions.TabSize, LanguageNames.CSharp, 4);
AddProjectToWorkspace(workspace, "project.json", new[] { "dnx451", "dnxcore50" }, sourceFiles);
return workspace;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/OmniSharp.Tests/TypeLookupFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public async Task OmitsNamespaceForNonRegularCSharpSyntax()

var workspace = TestHelpers.CreateCsxWorkspace(source1);

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var response = await controller.TypeLookup(new TypeLookupRequest { FileName = "dummy.csx", Line = 1, Column = 8 });

Assert.Equal("Foo", response.Type);
Expand All @@ -28,7 +28,7 @@ class Foo {}

var workspace = TestHelpers.CreateSimpleWorkspace(source1);

var controller = new OmnisharpController(workspace, null);
var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions());
var response = await controller.TypeLookup(new TypeLookupRequest { FileName = "dummy.cs", Line = 2, Column = 20 });

Assert.Equal("Bar.Foo", response.Type);
Expand Down

0 comments on commit b9cd005

Please sign in to comment.