Пример #1
0
        public int Main()
        {
            consoleOut.WriteLine("Start time: {0}", DateTime.Now.ToShortTimeString());
            // add path
            foreach (string assemblyPath in this.Arguments.AssemblyPath)
            {
                this.resolver.AddHintDirectory(assemblyPath);
            }

            // store real console
            listener.Writer = Console.Out;
            timer.Start();
            try
            {
                ReportResult   result = new ReportResult();
                IFixtureFilter filter = arguments.GetFilter();

                if (this.Arguments.Files.Length == 0)
                {
                    consoleOut.WriteLine("[warning] No test assemblies to execute");
                }
                else
                {
                    consoleOut.WriteLine("[info] Loading test assemblies");
                    using (
                        TestDomainDependencyGraph graph =
                            TestDomainDependencyGraph.BuildGraph(
                                this.Arguments.Files,
                                this.Arguments.AssemblyPath,
                                filter, this.Arguments.Verbose))
                    {
                        //define an assembly resolver routine in case the CLR cannot find our assemblies.
                        AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolveHandler);


                        graph.Log += new ErrorReporter(graph_Log);
                        consoleOut.WriteLine("[info] Starting execution");
                        ReportResult r = graph.RunTests();
                        graph.Log -= new ErrorReporter(graph_Log);
                        result.Merge(r);
                    }
                }

                this.GenerateReport(arguments, result);
                timer.Stop();
                consoleOut.WriteLine("[info] MbUnit execution finished in {0}s.", timer.Duration);
                return((0 == result.Counter.FailureCount) ? 0 : -1);
            }
            catch (System.Runtime.Remoting.RemotingException remote)
            {
                consoleOut.WriteLine("Could not load test domain.  Please ensure you have referenced the installed version of MbUnit.Framework within your test assembly. \r\n The error message was: \r\n" + remote.Message);
                return(-3);
            }
            catch (Exception ex)
            {
                consoleOut.WriteLine(ex.ToString());
                return(-3);
            }
        }
Пример #2
0
        public void StartStopImmediately()
        {
            TimeMonitor timer = new TimeMonitor();

            timer.Start();
            timer.Stop();
            Assert.LowerEqualThan(0, timer.Duration);
        }
Пример #3
0
            public override void Run(object fixture)
            {
                TimeMonitor monitor = new TimeMonitor();

                monitor.Start();
                this.TestCase.Run(fixture);
                monitor.Stop();

                Assert.IsLowerEqual(monitor.Duration, this.Attribute.MaxDuration);
            }
Пример #4
0
        /// <summary>
        /// Stops the timer and verifies whether or not the duration of its count is less than the maxDuration specified.
        /// </summary>
        public void Stop()
        {
            timer.Stop();

            Assert.IsTrue(timer.Duration < this.maxDuration,
                          "Timer duration {0}s is longer that maximum duration {1}s",
                          timer.Duration,
                          this.maxDuration
                          );
        }
Пример #5
0
        public void StartStopShowValues()
        {
            TimeMonitor timer = new TimeMonitor();

            timer.Start();
            Random rnd = new Random();

            for (int i = 0; i < 10000; ++i)
            {
                rnd.NextDouble();
            }
            timer.Stop();
            TypeHelper.ShowPropertyValues(timer);
        }
Пример #6
0
 /// <summary>
 /// We are finished with progress
 /// </summary>
 /// <param name="delay">Delay time in Milli Seconds</param>
 public void Finalise(int delay = 0)
 {
     if (Progress != null)
     {
         Message         += "... Finished";
         ProgressBarValue = 100;
         Progress((int)ProgressBarValue, Message);
         //add delay to allow progress indicter to catch up
         if (delay > 0)
         {
             var delayNo = TimeMonitor.ElapsedMilliseconds + delay;
             while (TimeMonitor.ElapsedMilliseconds < delayNo && TimeMonitor.IsRunning)
             {
             }
         }
         TimeMonitor.Stop();
     }
 }
Пример #7
0
        public override Object Execute(Object o, IList args)
        {
            timer.Start();
            // run test
            Object result = this.Invoker.Execute(o, args);

            timer.Stop();
            // checkl time is in bounds
            if (timer.Duration <= this.MinDuration || timer.Duration >= this.MaxDuration)
            {
                throw new MethodDurationException(
                          this.MinDuration,
                          this.MaxDuration,
                          timer.Duration,
                          this,
                          o,
                          args
                          );
            }

            return(result);
        }
Пример #8
0
        public void StopBeforeStart()
        {
            TimeMonitor timer = new TimeMonitor();

            timer.Stop();
        }