private void TestHover(int line, int character, params string[] expectedResults) { var hoverProvider = new HoverProvider(m_fixture.ProviderContext); var result = hoverProvider.Hover( new TextDocumentPositionParams() { Position = new Position() { Line = line - 1, Character = character - 1, }, TextDocument = new TextDocumentIdentifier() { Uri = m_fixture.GetChildUri(@"module\hoverTests.bxt").ToString() } }, CancellationToken.None); Assert.True(result.IsSuccess); // Hover provider could return null. var enumResults = (result.SuccessValue?.Contents ?? new object[] {}).GetEnumerator(); var enumExpectedContents = expectedResults.GetEnumerator(); while (enumResults.MoveNext()) { Assert.True(enumResults.Current is StringOrObject <MarkedString>); Assert.True(enumExpectedContents.MoveNext()); Assert.Equal(enumExpectedContents.Current, (enumResults.Current as StringOrObject <MarkedString>).Right.Value); } }
private void TestHover(int line, int character, params string[] expectedResults) { var hoverProvider = new HoverProvider(m_fixture.ProviderContext); var result = hoverProvider.Hover( new TextDocumentPositionParams() { Position = new Position() { Line = line - 1, Character = character - 1, }, TextDocument = new TextDocumentIdentifier() { Uri = m_fixture.GetChildUri(@"module\hoverTests.bxt") } }, CancellationToken.None); Assert.True(result.IsSuccess); if (result.SuccessValue == null) { Assert.False(expectedResults.Any()); return; } // Hover provider could return null. var enumExpectedContents = expectedResults.GetEnumerator(); var enumResults = ((SumType <string, MarkedString>[])result.SuccessValue.Contents).GetEnumerator(); while (enumResults.MoveNext()) { Assert.True(enumResults.Current is SumType <string, MarkedString>); Assert.True(enumExpectedContents.MoveNext()); Assert.Equal(enumExpectedContents.Current, ((MarkedString)(SumType <string, MarkedString>)enumResults.Current).Value); } }