【发布时间】:2010-10-04 14:06:01
【问题描述】:
我有自定义事件记录器,我想对其进行测试。
[Test]
public void AddLogWithExceptionAndEventLogEntryTypeTest()
{
const string loggerName = "mockLoggerName";
var logger = new MyLogger(loggerName);
System.Diagnostics.EventLog log = new System.Diagnostics.EventLog("System");
string logValue = Guid.NewGuid().ToString();
logger.AddEntry(new Exception(logValue),EventLogEntryType.Error );
foreach (
EventLogEntry entry in log.Entries)
{
if (entry.Message.ToUpper().Contains(logValue))
{
//what can is do ?
}
}
}
使用什么断言来提供信息,添加了那个条目?
【问题讨论】:
-
你用的是什么单元测试框架?
标签: c# unit-testing nunit rhino-mocks event-log