public void TestInvalidKill() { using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION); Assert.Throws <InvalidOperationException>(() => wrapper.Kill()); wrapper.Execute(); wrapper.Kill(); Assert.Throws <InvalidOperationException>(() => wrapper.Kill()); }
public void TestKill() { using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION); wrapper.Execute(); wrapper.Kill(); Assert.False(wrapper.Executing); }
public void TestKillEventFired() { using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION); bool eventFired = false; wrapper.Killed += (_, __) => eventFired = true; wrapper.Execute(); wrapper.Kill(); wrapper.KilledMRE.Wait(); Assert.True(eventFired); }
public void TestOutput() { using CWrapper wrapper = GetWrapper(); string returnData = null; wrapper.OutputDataReceived += (_, e) => returnData = e.Data; wrapper.Execute(EchoConsole.Program.FLOOD_KEY); wrapper.OutputDataMRE.Wait(); wrapper.Kill(); Assert.Equal(EchoConsole.Program.FLOOD_OUTPUT, returnData); }
public void TestInput() { const string ECHO_DATA = "This data shall be echoed"; string returnData = null; using CWrapper wrapper = GetWrapper(); wrapper.OutputDataReceived += (_, e) => returnData = e.Data; wrapper.Execute(); wrapper.WriteToConsole(ECHO_DATA); wrapper.OutputDataMRE.Wait(); wrapper.Kill(); Assert.Equal(ECHO_DATA, returnData); }