Unit-test FileSystemWatcher.Error Event

Posted by dotNetkow on Stack Overflow See other posts from Stack Overflow or by dotNetkow
Published on 2010-03-30T16:41:13Z Indexed on 2010/03/30 16:43 UTC
Read the original article Hit count: 619

I'm trying to unit test a private method that I have attached to my FileSystemWatcher's Error event. MSDN says that this event "occurs when the internal buffer overflows." I've tried to cause a buffer overflow but have not been successful so far. The FileSystemWatcher's various properties are:

fileWatcher.IncludeSubdirectories = false;
fileWatcher.Filter = "*";
fileWatcher.NotifyFilter = (NotifyFilters.FileName | NotifyFilters.LastAccess | NotifyFilters.Size);

What is the best way of raising this event for the purpose of unit-testing?

© Stack Overflow or respective owner

Related posts about c#

Related posts about filesystemwatcher