Can't Create Mole Type for System.Diagnostics.EventLog
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~
精彩评论