コード例 #1
0
        public void ConsoleTest()
        {
            lock (mutex)
            {
                Perf.ClearHandlers();
                Perf.UseVerboseConsole();
                Perf.UseUdpClient("127.0.0.1", 26778);

                using (ConsoleAgent.Begin())
                {
                    Perf.Set();
                    Thread.Sleep(1);
                    Perf.Set("P2");
                    Thread.Sleep(1);
                    Perf.End();

                    var output = ConsoleAgent.ReadAllText();

                    Assert.True(output.IsMatch(new Regex(@"PerfProbe at  \d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}  \(Thread: \d+\)
  File    : .+?PerfProbe.Test\\UnitTest1.cs
  Title   : \(null\)
  Lines   : \d+ ~ \d+
  Caller  : ConsoleTest
  Elapsed : \d{2}:\d{2}:\d{2}\.\d{7}
  Under   : .*?

PerfProbe at  \d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}  \(Thread: \d+\)
  File    : .+?PerfProbe.Test\\UnitTest1.cs
  Title   : P2
  Lines   : \d+ ~ \d+
  Caller  : ConsoleTest
  Elapsed : \d{2}:\d{2}:\d{2}.\d{7}
  Under   : .*?

")));
                }
            }
        }