0

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?

Mike Christian
  • 1,526
  • 1
  • 15
  • 27
  • Decided to build a mock that inherits EventLog, and then inject it into the methods through a constructor or input parameter. – Mike Christian Aug 18 '11 at 00:53

1 Answers1

1

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~

BoydWang
  • 11
  • 1