コード例 #1
0
ファイル: RSessionTest.cs プロジェクト: skrutsick/RTVS
        public async Task StopReentrantLoop()
        {
            var callback = new RSessionCallbackStub();
            var session  = new RSession(0, _testMethod.FileSystemSafeName, _brokerClient, new AsyncReaderWriterLock().CreateExclusiveReaderLock(), () => { });

            await session.StartHostAsync(new RHostStartupInfo(), callback, 50000);

            var testMrs = new AsyncManualResetEvent();

            callback.PlotHandler = (message, ct) => {
                testMrs.Set();
                return(session.EvaluateAsync("x <- 1\n"));
            };

            Task responceTask;

            using (var interaction = await session.BeginInteractionAsync()) {
                responceTask = interaction.RespondAsync("plot(1)\n");
            }

            await testMrs.WaitAsync().Should().BeCompletedAsync();

            await session.StopHostAsync().Should().BeCompletedAsync(20000);

            session.IsHostRunning.Should().BeFalse();

            await responceTask.Should().BeCanceledAsync();
        }
コード例 #2
0
 public CancelAll(IServiceContainer services, TestMethodFixture testMethod, TaskObserverMethodFixture taskObserver)
 {
     _taskObserver = taskObserver;
     _callback     = new RSessionCallbackStub();
     _brokerClient = CreateLocalBrokerClient(services, nameof(RSessionTest) + nameof(CancelAll));
     _session      = new RSession(0, testMethod.FileSystemSafeName, _brokerClient, new AsyncReaderWriterLock().CreateExclusiveReaderLock(), () => {});
 }
コード例 #3
0
ファイル: RSessionTest.ReadInput.cs プロジェクト: mvacha/RTVS
 public ReadInput(CoreServicesFixture coreServices, TestMethodFixture testMethod, TaskObserverMethodFixture taskObserver)
 {
     _taskObserver = taskObserver;
     _brokerClient = CreateLocalBrokerClient(coreServices, nameof(RSessionTest) + nameof(ReadInput));
     _session      = new RSession(0, testMethod.FileSystemSafeName, _brokerClient, new AsyncReaderWriterLock().CreateExclusiveReaderLock(), () => { });
     _callback     = new RSessionCallbackStub();
 }
コード例 #4
0
 public ReadInput(TestMethodFixture testMethod)
 {
     _testMethodFixture = testMethod;
     _testMethod        = testMethod.MethodInfo;
     _session           = new RSession(0, () => { });
     _callback          = new RSessionCallbackStub();
 }
コード例 #5
0
 public ReadInput(TestMethodFixture testMethod, TaskObserverMethodFixture taskObserver)
 {
     _taskObserver = taskObserver;
     _testMethod   = testMethod.MethodInfo;
     _session      = new RSession(0, () => { });
     _callback     = new RSessionCallbackStub();
 }
コード例 #6
0
ファイル: RSessionTest.ReadInput.cs プロジェクト: jflam/RTVS
 public ReadInput(TestMethodFixture testMethod, TaskObserverMethodFixture taskObserver)
 {
     _taskObserver = taskObserver;
     _testMethod   = testMethod.MethodInfo;
     _brokerClient = CreateLocalBrokerClient(nameof(RSessionTest) + nameof(ReadInput));
     _session      = new RSession(0, _brokerClient, () => { });
     _callback     = new RSessionCallbackStub();
 }
コード例 #7
0
 public ReadInput(TestMethodFixture testMethod, TaskObserverMethodFixture taskObserver)
 {
     _taskObserver    = taskObserver;
     _testMethod      = testMethod.MethodInfo;
     _brokerConnector = new RHostBrokerConnector();
     _brokerConnector.SwitchToLocalBroker(nameof(RSessionTest) + nameof(ReadInput));
     _session  = new RSession(0, _brokerConnector, () => { });
     _callback = new RSessionCallbackStub();
 }
コード例 #8
0
 public ReadInput(IServiceContainer services, TestMethodFixture testMethod)
 {
     _brokerClient = CreateLocalBrokerClient(services, nameof(RSessionTest) + nameof(ReadInput));
     _session      = new RSession(0, testMethod.FileSystemSafeName, _brokerClient, new AsyncReaderWriterLock().CreateExclusiveReaderLock(), () => { });
     _callback     = new RSessionCallbackStub();
 }