Пример #1
0
        public void VariableTraceListener_Will_Output_Correct_Value()
        {
            var output = new Listener();
            var variableTraceListener = new VariableTraceListener(ref output);
            const string expected = "Listener Test";

            Trace.Listeners.Add(variableTraceListener);
            Trace.WriteLine(expected);

            Assert.AreEqual(expected, output.Message);
        }
Пример #2
0
        public void VariableTraceListener_Will_Output_Correct_Value()
        {
            var          output = new Listener();
            var          variableTraceListener = new VariableTraceListener(ref output);
            const string expected = "Listener Test";

            Trace.Listeners.Add(variableTraceListener);
            Trace.WriteLine(expected);

            Assert.AreEqual(expected, output.Message);
        }
Пример #3
0
        public void TraceProfiler_Will_Profile_DurationOf_Sleep2000()
        {
            var output = new Listener();
            var variableTraceListener = new VariableTraceListener(ref output);
            Trace.Listeners.Add(variableTraceListener);

            using (new TraceProfiler("Cat"))
            {
                Thread.Sleep(2000);
            }

            Assert.AreEqual("x", output.Message);
        }
Пример #4
0
        public void TraceProfiler_Will_Profile_DurationOf_Sleep2000()
        {
            var output = new Listener();
            var variableTraceListener = new VariableTraceListener(ref output);

            Trace.Listeners.Add(variableTraceListener);

            using (new TraceProfiler("Cat"))
            {
                Thread.Sleep(2000);
            }

            Assert.AreEqual("x", output.Message);
        }