public void UpdateNotifierProvider_should_not_throw_StackOverflowException_when_added_self() { var notifier1 = Mock.Of <IScenarioProgressNotifier>(); var notifier2 = Mock.Of <IScenarioProgressNotifier>(); var configuration = new ScenarioProgressNotifierConfiguration(); configuration.UpdateNotifierProvider(() => notifier1); var previous = configuration.NotifierProvider; configuration .UpdateNotifierProvider <object>(feature => new DelegatingScenarioProgressNotifier(previous(feature), notifier2)); var notifier = configuration.NotifierProvider(new object()); notifier.NotifyScenarioStart(Mock.Of <IScenarioInfo>()); Mock.Get(notifier1).Verify(x => x.NotifyScenarioStart(It.IsAny <IScenarioInfo>()), Times.Once); Mock.Get(notifier2).Verify(x => x.NotifyScenarioStart(It.IsAny <IScenarioInfo>()), Times.Once); }
public void AppendNotifierProvider_should_not_throw_StackOverflowException_when_added_self() { var notifier1 = Mock.Of <IScenarioProgressNotifier>(); var configuration = new ScenarioProgressNotifierConfiguration(); configuration.UpdateNotifierProvider(() => notifier1); configuration .AppendNotifierProviders(configuration.NotifierProvider); var notifier = configuration.NotifierProvider(new object()); notifier.NotifyScenarioStart(Mock.Of <IScenarioInfo>()); Mock.Get(notifier1).Verify(x => x.NotifyScenarioStart(It.IsAny <IScenarioInfo>()), Times.Exactly(2)); }