示例#1
0
        private async Task VerifyCreateSession(TestServerType serverType, [CallerMemberName] string testName = "")
        {
            await TestServiceDriverProvider.RunTestIterations(async (timer) =>
            {
                ConnectParams connectParams = TestServiceProvider.Instance.ConnectionProfileService.GetConnectionParameters(serverType, SqlTestDb.MasterDatabaseName);
                using (TestServiceDriverProvider testService = new TestServiceDriverProvider())
                    using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
                    {
                        var result = await testService.CalculateRunTime(() => testService.RequestObjectExplorerCreateSession(connectParams.Connection), timer);

                        Assert.NotNull(result);
                        Assert.True(result.Success);
                        Assert.False(string.IsNullOrEmpty(result.SessionId), "Session id cannot be empty");

                        await testService.RequestObjectExplorerCloseSession(new ObjectExplorer.Contracts.CloseSessionParams
                        {
                            SessionId = result.SessionId
                        });
                        await testService.Disconnect(queryTempFile.FilePath);
                    }
            }, testName);
        }