I'm trying to do something along the lines of:
A.CallTo(() => fakeTimer.Start()).Invokes(() =>
fakeTimer.Elapsed += Raise.With<ElapsedEventArgs>(ElapsedEventArgs.Empty).Now);
The fakeTimer
is a fake of ITimer
, a wrapper interface per this answer.
Obviously this doesn't work, since I cannot do an assignment inside an Experssion Tree.
What I am actually tying to achieve is simulating raising timer events when the Start
method was called. This way I can assert that a call to Start
indeed happened.
Any (alternative) ideas?
Edit I'm an idiot and the fault is my own! I accidentally added an extra A.CallTo
, where I shouldn't have. Instead of deleting this question, I'll keep it to award Patrik Hägne his rightful reputation :)
I'm not really sure what you're trying to do, is this it???
A.CallTo(() => fakeTimer.Start()).Invokes(() =>
fakeTimer.Elapsed += Raise.With<ElapsedEventArgs>(ElapsedEventArgs.Empty).Now);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With