Ejemplo n.º 1
0
        public void TestMethod4()
        {
            ITracer tracer  = new StackTracer();
            var     thread1 = new Thread(StartSlowMethods);

            thread1.Start(tracer);
            StartSuperFastMethods(tracer);
            StartFastMethods(tracer);
            StartSuperSlowMethods(tracer);
            thread1.Join();

            var traceResult = tracer.GetTraceResult();

            int methodsAtAll = 0;

            foreach (var thread in traceResult.threads)
            {
                foreach (var method in thread.methods)
                {
                    methodsAtAll += 1 + countNestedMethods(method);
                }
            }

            Assert.AreEqual(6, methodsAtAll,
                            string.Format("Expected {0} methods at all, instead got {1}", 6, methodsAtAll));
        }
Ejemplo n.º 2
0
        public void TestMethod1()
        {
            ITracer tracer = new StackTracer();
            var     slow   = new SlowClass(tracer);

            slow.SuperSlow();
            var traceResult = tracer.GetTraceResult();

            Assert.IsNotNull(traceResult);
            Assert.AreEqual(1, traceResult.threads.Count,
                            string.Format("Expected {0} threads, instead got {1}", 1, traceResult.threads.Count));
        }
Ejemplo n.º 3
0
        public void TestMethod3()
        {
            ITracer tracer = new StackTracer();

            StartFastMethods(tracer);
            StartSuperSlowMethods(tracer);
            StartFastMethods(tracer);
            StartSuperSlowMethods(tracer);

            var traceResult = tracer.GetTraceResult();

            Assert.AreEqual(4, traceResult.threads[0].methods.Count,
                            string.Format("Expected {0} root methods in main thread, instead got {1}", 4,
                                          traceResult.threads[0].methods.Count));
        }
Ejemplo n.º 4
0
        public void TestMethod2()
        {
            ITracer tracer = new StackTracer();
            var     thread = new Thread(StartFastMethods);

            thread.Start(tracer);
            StartSuperSlowMethods(tracer);
            thread.Join();


            var traceResult = tracer.GetTraceResult();

            Assert.AreEqual(2, traceResult.threads.Count,
                            string.Format("Expected {0} threads, instead got {1}", 2, traceResult.threads.Count));
        }