static void Main(string[] args) { Console.CancelKeyPress += Console_CancelKeyPress; using (var logger = new Logger("Program", new MaxLoggingPermissions(), FileLogWriter.InTempFolder("Microsoft.R.Host.Client.Program"))) { var services = new CoreServices(new AppConstants(), null, new MaxLoggingPermissions(), null, null, null, null, null, null, null); var localConnector = new LocalBrokerClient("Program", args[0], services, new NullConsole()); var host = localConnector.ConnectAsync(new BrokerConnectionInfo("Program", new Program())).GetAwaiter().GetResult(); _evaluator = host; host.Run().GetAwaiter().GetResult(); } }
public async Task StopBeforeInitialized_RHostMissing() { var brokerClient = new LocalBrokerClient(nameof(RSessionTest), @"C:\", TestCoreServices.CreateReal(), new NullConsole(), Environment.SystemDirectory); var session = new RSession(0, brokerClient, new AsyncReaderWriterLock().CreateExclusiveReaderLock(), () => { }); Func<Task> start = () => session.StartHostAsync(new RHostStartupInfo { Name = _testMethod.Name }, null, 10000); var startTask = Task.Run(start).SilenceException<RHostBrokerBinaryMissingException>(); await session.StopHostAsync(); session.IsHostRunning.Should().BeFalse(); await startTask; }
public void StartRHostMissing() { var brokerClient = new LocalBrokerClient(nameof(RSessionTest), @"C:\", TestCoreServices.CreateReal(), new NullConsole(), Environment.SystemDirectory); var session = new RSession(0, brokerClient, new AsyncReaderWriterLock().CreateExclusiveReaderLock(), () => { }); Func<Task> start = () => session.StartHostAsync(new RHostStartupInfo { Name = _testMethod.Name }, null, 10000); start.ShouldThrow<RHostBrokerBinaryMissingException>(); }