public void ShouldInvokeMethodOnAllSpecifiedListeners() { var mockFirstEventListener = MockRepository.GenerateMock <IEventListener>(); var mockSecondEventListener = MockRepository.GenerateMock <IEventListener>(); EventListener listener = new MultiOutputEventListener(mockFirstEventListener, mockSecondEventListener); listener.RunStarted(); mockFirstEventListener.AssertWasCalled(l => l.RunStarted()); mockSecondEventListener.AssertWasCalled(l => l.RunStarted()); }
private void Initialize(TaskExecutionNode node) { config = NBehaveConfiguration.New; var codeGenListener = new CodeGenEventListener(); var resharperResultNotifier = new ResharperResultPublisher(node.Children, Server, codeGenListener); var listener = new NBehaveTaskRunnerListener(resharperResultNotifier); var files = node.Children.Select(_ => ((NBehaveFeatureTask)_.RemoteTask).FeatureFile).Distinct().ToList(); var asm = (NBehaveAssemblyTask)node.RemoteTask; var assemblies = new[] { asm.AssemblyFile }; var eventListener = new MultiOutputEventListener(codeGenListener, listener); ModifyConfig(files, assemblies, eventListener); }
private static MultiOutputEventListener AddEventListeners(IEnumerable <IEventListener> eventListenersArg) { var eventListeners = new List <IEventListener>(); eventListeners.AddRange(eventListenersArg); if (eventListeners.Any() == false) { eventListeners.Add(EventListeners.EventListeners.ColorfulConsoleOutputEventListener()); } eventListeners.Add(new FailSpecResultEventListener()); var multiEventListener = new MultiOutputEventListener(eventListeners.ToArray()); return(multiEventListener); }
private static void Execute(this string scenario, StoryRunnerFilter filter, IEnumerable <Assembly> assemblies, params IEventListener[] eventListenersArg) { var eventListeners = new List <IEventListener>(); eventListeners.AddRange(eventListenersArg); eventListeners.Add(new ColorfulConsoleOutputEventListener()); eventListeners.Add(new FailSpecResultEventListener()); var multiEventListener = new MultiOutputEventListener(eventListeners.ToArray()); var builder = new TextScenarioRunner(multiEventListener, assemblies, filter); builder.Run(scenario); }