Ejemplo n.º 1
0
        public void Add(IRunnerResultProcessor output)
        {
            var temp = new IRunnerResultProcessor[_processors.Length + 1];

            Array.Copy(_processors, temp, _processors.Length);
            temp[_processors.Length] = output;
            _processors = temp;
        }
Ejemplo n.º 2
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();
                    };
                }
            }
        }
Ejemplo n.º 3
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!
        }