public void ShouldNotifyBeforeItemFinishing() { ILaunchReporter l = null; ITestReporter t = null; BeforeLaunchFinishingEventArgs beforeLaunchFinishingEventArgs = null; BeforeTestFinishingEventArgs beforeTestFinishingEventArgs = null; var observer = new Mock <IReportEventsObserver>(); observer.Setup(o => o.Initialize(It.IsAny <IReportEventsSource>())).Callback <IReportEventsSource>(s => { s.OnBeforeLaunchFinishing += (a, b) => { l = a; beforeLaunchFinishingEventArgs = b; }; s.OnBeforeTestFinishing += (a, b) => { t = a; beforeTestFinishingEventArgs = 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(); beforeLaunchFinishingEventArgs.ClientService.Should().BeSameAs(client); l.Should().BeSameAs(launch); beforeLaunchFinishingEventArgs.FinishLaunchRequest.Should().NotBeNull(); beforeTestFinishingEventArgs.ClientService.Should().BeSameAs(client); t.Should().BeSameAs(launch.ChildTestReporters[0]); beforeTestFinishingEventArgs.FinishTestItemRequest.Should().NotBeNull(); }
private BeforeLaunchFinishingEventArgs NotifyFinishing(FinishLaunchRequest request) { var args = new BeforeLaunchFinishingEventArgs(_service, _configuration, request); Notify(() => ReportEventsSource.RaiseBeforeLaunchFinishing(_reportEventsSource, this, args)); return(args); }
public static void RaiseBeforeLaunchFinishing(ReportEventsSource source, ILaunchReporter launchReporter, BeforeLaunchFinishingEventArgs args) { source.OnBeforeLaunchFinishing?.Invoke(launchReporter, args); }