public void ShouldNotifyBeforeItemStarting() { ILaunchReporter l = null; ITestReporter t = null; BeforeLaunchStartingEventArgs beforeLaunchStartingEventArgs = null; BeforeTestStartingEventArgs beforeTestStartingEventArgs = null; var observer = new Mock <IReportEventsObserver>(); observer.Setup(o => o.Initialize(It.IsAny <IReportEventsSource>())).Callback <IReportEventsSource>(s => { s.OnBeforeLaunchStarting += (a, b) => { l = a; beforeLaunchStartingEventArgs = b; }; s.OnBeforeTestStarting += (a, b) => { t = a; beforeTestStartingEventArgs = b; }; }); var extManager = new Shared.Extensibility.ExtensionManager(); extManager.ReportEventObservers.Add(observer.Object); var client = new MockServiceBuilder().Build().Object; var launch = new LaunchReporterBuilder(client).With(extManager).Build(1, 0, 0); launch.Sync(); beforeLaunchStartingEventArgs.ClientService.Should().BeSameAs(client); l.Should().BeSameAs(launch); beforeLaunchStartingEventArgs.StartLaunchRequest.Should().NotBeNull(); beforeTestStartingEventArgs.ClientService.Should().BeSameAs(client); t.Should().BeSameAs(launch.ChildTestReporters[0]); beforeTestStartingEventArgs.StartTestItemRequest.Should().NotBeNull(); }
private BeforeLaunchStartingEventArgs NotifyStarting(StartLaunchRequest request) { var args = new BeforeLaunchStartingEventArgs(_service, _configuration, request); Notify(() => ReportEventsSource.RaiseBeforeLaunchStarting(_reportEventsSource, this, args)); return(args); }
public static void RaiseBeforeLaunchStarting(ReportEventsSource source, ILaunchReporter launchReporter, BeforeLaunchStartingEventArgs args) { source.OnBeforeLaunchStarting?.Invoke(launchReporter, args); }