public InteractiveHostTests() { _host = new InteractiveHost(typeof(CSharpReplServiceProvider), GetInteractiveHostPath(), ".", millisecondsTimeout: -1); RedirectOutput(); _host.ResetAsync(new InteractiveHostOptions(initializationFile: null, culture: CultureInfo.InvariantCulture)).Wait(); var remoteService = _host.TryGetService(); Assert.NotNull(remoteService); _host.SetPathsAsync(new[] { s_fxDir }, new[] { s_homeDir }, s_homeDir).Wait(); // assert and remove logo: var output = SplitLines(ReadOutputToEnd()); var errorOutput = ReadErrorOutputToEnd(); Assert.Equal("", errorOutput); Assert.Equal(2, output.Length); Assert.Equal("Microsoft (R) Roslyn C# Compiler version " + FileVersionInfo.GetVersionInfo(_host.GetType().Assembly.Location).FileVersion, output[0]); // "Type "#help" for more information." Assert.Equal(FeaturesResources.TypeHelpForMoreInformation, output[1]); // remove logo: ClearOutput(); }
public InteractiveHostTests() { Host = new InteractiveHost(typeof(CSharpRepl), GetInteractiveHostPath(), ".", millisecondsTimeout: -1); RedirectOutput(); Host.ResetAsync(InteractiveHostOptions.Default).Wait(); var remoteService = Host.TryGetService(); Assert.NotNull(remoteService); remoteService.SetTestObjectFormattingOptions(); // assert and remove logo: var output = ReadOutputToEnd().Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); var errorOutput = ReadErrorOutputToEnd(); Assert.Equal("", errorOutput); Assert.Equal(2, output.Length); Assert.Equal("Microsoft (R) Roslyn C# Compiler version " + FileVersionInfo.GetVersionInfo(Host.GetType().Assembly.Location).FileVersion, output[0]); // "Type "#help" for more information." Assert.Equal(FeaturesResources.TypeHelpForMoreInformation, output[1]); // remove logo: ClearOutput(); }
private async Task <ExecutionResult> ResetAsyncWorker(bool initialize = true) { try { var options = new InteractiveHostOptions( initializationFile: initialize ? _responseFilePath : null, culture: CultureInfo.CurrentUICulture); var result = await _interactiveHost.ResetAsync(options).ConfigureAwait(false); if (result.Success) { UpdateResolvers(result); } return(new ExecutionResult(result.Success)); } catch (Exception e) when(FatalError.Report(e)) { throw ExceptionUtilities.Unreachable; } }
private async Task <ExecutionResult> ResetAsyncWorker(bool initialize = true) { try { var options = InteractiveHostOptions.Default.WithInitializationFile(initialize ? _responseFilePath : null); // async as this can load references, run initialization code, etc. var result = await _interactiveHost.ResetAsync(options).ConfigureAwait(false); // TODO: set up options //if (result.Success) //{ // UpdateLocalPaths(result.NewReferencePaths, result.NewSourcePaths, result.NewWorkingDirectory); //} return(new ExecutionResult(result.Success)); } catch (Exception e) when(FatalError.Report(e)) { throw ExceptionUtilities.Unreachable; } }