public void HandleError() { FakeErrorSocket fakeSocket = new FakeErrorSocket(); fakeSocket.ErrorOnConnect = true; tracker = new Tracker(file, fakeSocket); bool errorReceived = false; tracker.Error += delegate(object sender, Exception se) { errorReceived = true; Assert.IsNotNull(se); }; tracker.Start(); Assert.IsTrue(errorReceived); }