forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestTraceListener.cs
More file actions
43 lines (39 loc) · 1.38 KB
/
TestTraceListener.cs
File metadata and controls
43 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace Simple.Data.SqlTest
{
public class TestTraceListener : TraceListener
{
private readonly StringBuilder _builder = new StringBuilder();
public override void Write(string message, string category)
{
if (category.Equals("Simple.Data.SqlTest"))
{
Write(message);
}
}
/// <summary>
/// When overridden in a derived class, writes the specified message to the listener you create in the derived class.
/// </summary>
/// <param name="message">A message to write. </param><filterpriority>2</filterpriority>
public override void Write(string message)
{
_builder.Append(message);
}
/// <summary>
/// When overridden in a derived class, writes a message to the listener you create in the derived class, followed by a line terminator.
/// </summary>
/// <param name="message">A message to write. </param><filterpriority>2</filterpriority>
public override void WriteLine(string message)
{
_builder.AppendLine(message);
}
public string Output
{
get { return _builder.ToString(); }
}
}
}