public MirrorSharpTestDriver SetTextWithCursor(string textWithCursor)
        {
            var parsed = TextWithCursor.Parse(textWithCursor);

            Session.ReplaceText(parsed.Text);
            Session.CursorPosition = parsed.CursorPosition;
            return(this);
        }
        public async Task ExecuteAsync_ProducesExpectedInfoTip(string textWithCursor, string expectedResultText, string[] expectedKinds)
        {
            var text   = TextWithCursor.Parse(textWithCursor, '➭');
            var driver = MirrorSharpTestDriver.New().SetText(text.Text);

            var result = await driver.SendRequestInfoTipAsync(text.CursorPosition);

            Assert.Equal(expectedKinds, result.Kinds);
            Assert.Equal(expectedResultText, result?.ToString());
        }
        public async Task ExecuteAsync_ProducesExpectedInfoTip(string textWithCursor, string expectedResultText, string[] expectedKinds)
        {
            var text   = TextWithCursor.Parse(textWithCursor, '➭');
            var driver = MirrorSharpTestDriver.New().SetText(text.Text);

            var result = await driver.SendRequestInfoTipAsync(text.CursorPosition);

            Assert.NotNull(result);
            // https://github.com/xunit/assert.xunit/pull/36#issuecomment-578990557
            Assert.Equal(expectedKinds, result !.Kinds);
            Assert.Equal(expectedResultText, result?.ToString());
        }
Exemplo n.º 4
0
        public async Task RequestInfoTip_IncludesXmlDocumentation()
        {
            var textWithCursor = TextWithCursor.Parse("class C { string M(int a) { return a.To➭String(); } }", '➭');
            var driver         = TestEnvironment.NewDriver().SetText(textWithCursor.Text);
            var result         = await driver.SendRequestInfoTipAsync(textWithCursor.CursorPosition);

            Assert.NotNull(result);
            var documentation = Assert.Single(result !.Sections.Where(e => e.Kind == QuickInfoSectionKinds.DocumentationComments.ToLowerInvariant()));

            Assert.Equal(
                "Converts the numeric value of this instance to its equivalent string representation.",
                documentation.ToString()
                );
        }
        public async Task ExecuteAsync_IncludesXmlDocCommentsInResult()
        {
            var text   = TextWithCursor.Parse("class C { string M(int a) { return a.To➭String(); } }", '➭');
            var driver = MirrorSharpTestDriver.New(MirrorSharpOptionsWithXmlDocumentation.Instance)
                         .SetText(text.Text);

            var result = await driver.SendRequestInfoTipAsync(text.CursorPosition);

            var documentation = Assert.Single(result.Sections.Where(e => e.Kind == QuickInfoSectionKinds.DocumentationComments.ToLowerInvariant()));

            Assert.Equal(
                "Converts the numeric value of this instance to its equivalent string representation.",
                documentation.ToString()
                );
        }