예제 #1
0
파일: Script.cs 프로젝트: rwaldron/magpie
 private void Machine_Printed(object sender, PrintEventArgs e)
 {
     if (Printed == null)
     {
         // if there are no event handlers, default to printing to the console
         Console.WriteLine(e.Text);
     }
     else
     {
         Printed(this, e);
     }
 }
예제 #2
0
        private void TestPrint(object sender, PrintEventArgs e)
        {
            if (mExpectedOutput.Count == 0)
            {
                mErrors.Add("got \"" + e.Text + "\" when not expecting any more output");
            }
            else
            {
                string expecting = mExpectedOutput.Dequeue();
                string actual = e.Text.Replace("\n", "\\n");

                if (expecting != actual)
                {
                    mErrors.Add("got \"" + actual + "\" when expecting \"" + expecting + "\"");
                }
            }
        }