Home > OS >  Can "event Action<>" be invoked with 3 type arguments using fakeiteasy in unit tests
Can "event Action<>" be invoked with 3 type arguments using fakeiteasy in unit tests

Time:09-22

I have looked quite a lot on the internet but somehow I am not grasping the concept to solve my problem. It should not be that complicated.

I have a SUT (System Under Test), which has an event action like:

    event Action<ISomeInterface, bool, string> DownloadFinished;

Now i want to raise this event using the fake object (using fakeiteasy), like:

fakeObject.DownloadFinished  = Raise.With<ISomeInterface, bool, string>();

but the above line shows error as it says "Raise cannot take 3 arguments". Could someone recommend how to solve this issue.

CodePudding user response:

According to my reading of the docs, if you're using a non-EventHandler event, you need to use Raise.FreeForm.With:

fakeObject.DownloadFinished  = Raise.FreeForm.With(implementerOfSomeInterface, false, string.Empty);

or similar

  • Related