简体   繁体   中英

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

I am building (yet another) Windows Service, using TDD and Moles. This project 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~

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM