public void GetFileEvents( ) { IFile file; var buffer = default(byte[]); var bytes = default(byte); long length; IFileEvents fileEvents = null; using (file = fMap.Get(TextFile)) { fileEvents = FileMap.GetFileEvents(file); file.Position = 0; length = file.Length; buffer = file.Read(length); } int eventCount = 0; fileEvents.Opened += (f) => { ++eventCount; }; fileEvents.Closed += (f) => { ++eventCount; }; --file.Position; using (file) { bytes = file.Read(); } Assert.AreEqual(2, eventCount); }