mardi 30 juillet 2019

How Test Null EventHandler

I have this code to test:

public event EventHandler<IMyEventArgs> MyEventHandler;

private void FireMyEvent => MyEventHandler?.Invoke(this, new MyEventArgs)

the piece of code

MyEventHandler?.Invoke(this, new MyEventArgs) 

it's

if(MyEventHandler != null) MyEventHandler.Invoke(this, MyEventArgs)

Now my problem is:

How I can test "MyEventHandler == null"???

Aucun commentaire:

Enregistrer un commentaire