Yes, for that to work you need to set up the setter and getter for the OnMyEvent property which the code I posted does.
There is nothing like the Raise.EventWith but if I understand that right this is not needed in Delphi because you can invoke an event from the outside unlike in C#.
Since there is no RTTI for properties on interfaces the auto mocking is not possible as is anything remotely similar to the syntax that NSubstitute does
because they are using generic extension methods and expressions that enable their fluent API - both features that Delphi does not have.
I opted for a more moq-like design before and likely have something similar for the properties. However, the syntax will have to call both the getter and
the setter and then internally they can be matched and connected to work as a property where it returns the value you previously set.
The following code is just an idea:
ServiceMock.SetupProperty.OnMyEvent := ServiceMock.Setup.Returns(<optional default value>).When.OnMyEvent;
or for a possibly shorter syntax (risking all the hate for using the keyword that shall not be used):
with ServiceMock.SetupProperty(<optional default value>) do OnMyEvent := OnMyEvent;
Both are a bit weird with assigning the property to itself but as I said the getter and setter have to be called to run to be set up.
As I said these are just some ideas going through my head syntax-wise - I have to check how to implement them internally.