nUnit rides along with exceptions from the .NET framework and you may be
able to assert your test on an event log exception. A handled exception by
your code would by default cause nUnit to fail an assertion test unless you
override it with an ExpectedException parameter in your test method.
You could also use a conditional assertion in nUnit to check the return
value of the write method in your logging classes, that way you could at
least evaluate against a succesful write. NUnit also recognizes unhandled
exceptions as an indicator that the code has failed in some way. As such, it
reports unhandled exceptions as failures of any test itself - you could
likely assume that any other result permutation is a success without having
to actually open the event log
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"Ole Hanson" <no@spam.com> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
Hi
I am trying to engineer a way of testing that my logging framework is
capable of writing to my eventlog. I want to include this test in my
already existing NUnit tests - but I'm a little low on ideas as how to assert that
I actually did write to the eventlog successfully.
Naturally I want this assertion without having to open my eventlog and
visually verify the writing.
Any ideas???
Thanks!