3

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.

AakashM
  • 62,551
  • 17
  • 151
  • 186
Newbie007
  • 55
  • 6
  • 1
    According to my reading of [the docs](https://fakeiteasy.readthedocs.io/en/stable/raising-events/), if you're using a non-`EventHandler` event, you need to use `Raise.FreeForm.With`. I haven't tried this. – AakashM Sep 20 '21 at 13:21
  • 1
    It works, you could make it like an answer and I will accept it. – Newbie007 Sep 20 '21 at 13:41

1 Answers1

3

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

AakashM
  • 62,551
  • 17
  • 151
  • 186