Unit Test Event Handler

Posted by Thomas Tran on Stack Overflow See other posts from Stack Overflow or by Thomas Tran
Published on 2012-03-21T04:29:03Z Indexed on 2012/03/21 5:29 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

I got this event handle and how can I do unit test for this

public class MyLearningEvent
{
    private event EventHandler _Closed;

    public event EventHandler Closed
    {
        add
        {
            _Closed -= value;
            _Closed += value;
        }
        remove
        {
            _Closed -= value;
        }
    }

    public void OnClosed()
    {
        if (_Closed != null) _Closed(this, EventArgs.Empty);
    }
}

Just modified code so that much clear

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about events