Пример #1
0
        public async Task HoverTestOnPrem()
        {
            TestServerType serverType = TestServerType.OnPrem;

            using (TestServiceDriverProvider testService = new TestServiceDriverProvider())
                using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
                {
                    const string query = Scripts.TestDbSimpleSelectQuery;
                    await testService.ConnectForQuery(serverType, query, queryTempFile.FilePath, Common.PerfTestDatabaseName);

                    Hover hover = await testService.CalculateRunTime(() => testService.RequestHover(queryTempFile.FilePath, query, 0, Scripts.TestDbComplexSelectQueries.Length + 1), true);

                    Assert.NotNull(hover);
                    await testService.Disconnect(queryTempFile.FilePath);
                }
        }
        public async Task HoverTest()
        {
            using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
                using (TestServiceDriverProvider testService = new TestServiceDriverProvider())
                {
                    string query = "SELECT * FROM sys.objects";

                    testService.WriteToFile(queryTempFile.FilePath, query);

                    DidOpenTextDocumentNotification openParams = new DidOpenTextDocumentNotification
                    {
                        TextDocument = new TextDocumentItem
                        {
                            Uri        = queryTempFile.FilePath,
                            LanguageId = "enu",
                            Version    = 1,
                            Text       = query
                        }
                    };

                    await testService.RequestOpenDocumentNotification(openParams);

                    Thread.Sleep(500);

                    bool connected = await testService.Connect(TestServerType.OnPrem, queryTempFile.FilePath);

                    Assert.True(connected, "Connection was not successful");

                    Thread.Sleep(10000);

                    Hover hover = await testService.RequestHover(queryTempFile.FilePath, query, 0, 15);

                    Assert.True(hover != null, "Hover tooltop is null");

                    await testService.Disconnect(queryTempFile.FilePath);
                }
        }