private void ExpectOutput(string[] args) { ExitUtil.DisableSystemExit(); ByteArrayOutputStream outContent = new ByteArrayOutputStream(); TextWriter originalPs = System.Console.Out; Runtime.SetOut(new TextWriter(outContent)); try { NativeLibraryChecker.Main(args); } catch (ExitUtil.ExitException) { ExitUtil.ResetFirstExitException(); } finally { if (Shell.Windows) { Assert.Equal(outContent.ToString().IndexOf("winutils: true") != -1, true); } if (NativeCodeLoader.IsNativeCodeLoaded()) { Assert.Equal(outContent.ToString().IndexOf("hadoop: true") != -1, true); } Runtime.SetOut(originalPs); } }
private void ExpectExit(string[] args) { try { // should throw exit exception NativeLibraryChecker.Main(args); Fail("should call exit"); } catch (ExitUtil.ExitException) { // pass ExitUtil.ResetFirstExitException(); } }