public void Init() { timer = Substitute.For <IHeartBeatTimer>(); invoke = Substitute.For <ISynchronizationContext>(); invoke.When(x => x.Post(Arg.Any <Action>())).Do(callInfo => { Assert.IsNull(lastInvokedAction); lastInvokedAction = callInfo.Arg <Action>(); }); agg = ((IProgressAggregatorFactory) new ProgressAggregator.Factory(timer, invoke)).CreateProgressAggregator(); outEvents = MakeOutEventsMock(agg); }