Hi guys, I'm not certain if this is the same issue as shown in
this thread (my results are a little different to ramnefors, and additionally I don't recognize that Isolate.Invoke.Event() method signature, but maybe this was the old version or something) so I just wanted to check whether my issues were related:
public class Z
{
public event EventHandler a;
public void RaiseA() { throw new NotImplementedException(); }
}
If I make a real object and raise the event (either explicitly or through a DoInstead callback) it works fine - this seems to be different to ramnefors experience.
[Test] [Isolated]
public void RealEvent()
{
var z = new Z();
z.a += (sender, args) => Console.WriteLine("Event raised!");
Isolate.Invoke.Event(() => z.a += null, new object[] { null, null });
Isolate.WhenCalled(() => z.RaiseA())
.DoInstead(context => Isolate.Invoke.Event(() => z.a += null, new object[] {null, null}));
z.RaiseA();
}
However doing the same for a faked object just does nothing (no error/exception thrown.)
[Test] [Isolated]
public void Fake()
{
var z = Isolate.Fake.Instance<Z>();
z.a += (sender, args) => Console.WriteLine("Event Raised");
Isolate.Invoke.Event(() => z.a += null, null);
Isolate.WhenCalled(() => z.RaiseA())
.DoInstead(context => Isolate.Invoke.Event(() => z.a += null, new object[] { null, null }));
z.RaiseA();
Is there a way to implement such behaviour (subscribe to a faked object's event and have them raised)?