开发者

Can't Create Mole Type for System.Diagnostics.EventLog

开发者 https://www.devze.com 2023-03-27 11:14 出处:网络
I am building (yet another) Windows Service, using TDD and Moles.This projec开发者_运维问答t includes extensions to System.Dagnostics.EventLog, tot include details of the input parameter Exception obj

I am building (yet another) Windows Service, using TDD and Moles. This projec开发者_运维问答t includes extensions to System.Dagnostics.EventLog, tot include details of the input parameter Exception object in the log message. I must verify the exception details and those of inner exceptions are being properly written to the event log. The extensions ultimately call System.Dagnostics.EventLog.WriteEntry.

I want to inject a detour to System.Diagnostics.Moles.MEventLog.WriteEntry. However, MEventLog doesn't exist (there is no SEventLog). Any ideas of how to isolate event log interaction?


you need to add moles to System, because System.Dagnostics is under namespace System, there are no separated library about System.Dagnostics. When you finished add System.Moles, rebuild your project, then you can using System.Diagnostics.Moles and MEventlog~

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号