示例#1
0
    public static void Main()
    {
        //todo: include electrical schematics

        /*  Pick a driver that matches your hardware setup */
        IDriveTextDisplays driver = null;

        // GPIO or MCP23017 driver
        driver = GetGpio8Driver();
        //driver = GetGpio4Driver();
        //driver = GetMcp8Driver();
        //driver = GetMcp4Driver();

        CharacterDisplay lcd = new CharacterDisplay(20, 4, driver)
        {
            IsCursorBlinking   = false,
            IsCursorUnderlined = false
        };

        /* Hook user input buttons */
        IRunnerUserInput input = null;

        // GPIO or MCP23017 indirected
        input = GetGpioInput();

        /* Run the tests */
        lcd.ClearScreen();
        TextTestHarness.RunTests(Assembly.GetExecutingAssembly(), lcd, input);
    }
示例#2
0
        public static void RunTests(Assembly assembly, IDisplayText lcd, IRunnerUserInput input = null, string logDirectory = null, bool showGcMessages = false)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }
            if (lcd == null)
            {
                throw new ArgumentNullException("lcd");
            }

            var ui = new FeedbackToTextDisplay(lcd);

            TestHarness.RunTests(assembly, input, ui, logDirectory, showGcMessages);
        }
示例#3
0
        public static void RunTests(Assembly assembly, IDigitalLed led, IRunnerUserInput input = null, string logDirectory = null, bool showGcMessages = false)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }
            if (led == null)
            {
                throw new ArgumentNullException("led");
            }

            FeedbackToLed ui = new FeedbackToLed(led);

            TestHarness.RunTests(assembly, input, ui, logDirectory, showGcMessages);
        }
示例#4
0
        public static void RunTests(Assembly assembly, IRunnerUserInput input = null, string logDirectory = null, bool showGcMessages = false)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }
            Debug.EnableGCMessages(showGcMessages);
            GuiTestHarness app = new GuiTestHarness(assembly, input, logDirectory);

            app.Run(new Window {
                Height     = SystemMetrics.ScreenHeight,
                Width      = SystemMetrics.ScreenWidth,
                Visibility = Visibility.Visible
            });
        }
示例#5
0
        public TestRunner(Assembly assemblyUnderTest, IRunnerUserInput input, IRunnerResultProcessor output)
        {
            _assemblyUnderTest = assemblyUnderTest;
            _output            = output;

            //hook input events if defined
            if (input != null)
            {
                if (input.StartTests != null)
                {
                    input.StartTests.OnInterrupt += (source, state, time) => {
                        Debug.Print("Attempt Restart");
                        ExecuteTests();
                    };
                }
            }
        }
示例#6
0
        public static void RunTests(Assembly assembly,
                                    IRunnerUserInput input        = null,
                                    IRunnerResultProcessor output = null,
                                    string logDirectory           = null,
                                    bool showGcMessages           = false)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }
            Debug.EnableGCMessages(showGcMessages);

            var dispatch = new FeedbackDispatcher();

            if (output != null)
            {
                dispatch.Add(output);
            }
            dispatch.Add(new FeedbackToDebug());
            if (BuildAutomation.InBuild)
            {
                dispatch.Add(new FeedbackToLogFiles());
            }
            else if (logDirectory != null)
            {
                dispatch.Add(new FeedbackToLogFiles(logDirectory));
            }

            TestRunner runner = new TestRunner(assembly, input, dispatch);

            runner.ExecuteTests()
            .Wait();

            if (!BuildAutomation.InBuild)
            {
                Thread.Sleep(Timeout.Infinite);
            }
            else
            {
                Thread.CurrentThread.Abort();
                //TaskScheduler.UnusedThreadTimeoutMilliseconds = 10;
                //Task.Run(() => { });
            }

            //todo: handle shutting down of emulator!
        }
示例#7
0
 private GuiTestHarness(Assembly assembly, IRunnerUserInput input, string logDirectory)
 {
     _assembly     = assembly;
     _input        = SystemInfo.IsEmulator ? new EmulatorButtons() : input;
     _logDirectory = logDirectory;
 }