Beispiel #1
0
 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());
 }
Beispiel #2
0
 public void TestKill()
 {
     using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION);
     wrapper.Execute();
     wrapper.Kill();
     Assert.False(wrapper.Executing);
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }