예제 #1
0
        public void WillExceptionEvent()
        {
            MacroEntry me = new MacroEntry {
                Macro = "kjdkdsdksdfsdk"
            };

            MacroInvoker mi = MacroInvoker.GetInstance();

            AutoResetEvent are = new AutoResetEvent(false);

            void OnExceptionEvent(Exception e)
            {
                Assert.IsTrue(mi.IsFaulted);
                Assert.IsNotNull(mi.Exception);
                are.Set();
            }

            mi.ExceptionEvent += OnExceptionEvent;

            mi.Execute(me);

            bool result = are.WaitOne(5000);

            Assert.IsTrue(result);
        }
예제 #2
0
        public void WillExecute()
        {
            MacroEntry me = new MacroEntry();

            MacroInvoker mi = MacroInvoker.GetInstance();

            mi.Execute(me);
        }
예제 #3
0
        public void WillExecuteRunDummy()
        {
            MacroEntry me = new MacroEntry {
                Macro = "Dummy(5,7)"
            };

            MacroInvoker mi = MacroInvoker.GetInstance();

            mi.Execute(me);

            mi.Thread.Join();

            Assert.IsFalse(mi.IsFaulted);
        }
예제 #4
0
        public void WillAbortRunning()
        {
            MacroEntry me = new MacroEntry {
                Macro = "while true:\r\n\t"
            };

            MacroInvoker mi = MacroInvoker.GetInstance();

            mi.Execute(me);

            mi.Stop();

            bool result = mi.Thread.Join(5000);

            Assert.IsTrue(result);
        }
예제 #5
0
        public void WillRaiseStoppedEvent()
        {
            MacroEntry me = new MacroEntry();

            MacroInvoker mi = MacroInvoker.GetInstance();

            AutoResetEvent are = new AutoResetEvent(false);

            void OnStoppedEvent()
            {
                are.Set();
            }

            mi.StoppedEvent += OnStoppedEvent;

            mi.Execute(me);

            bool result = are.WaitOne(5000);

            Assert.IsTrue(result);
        }