internal ReportingContextRegistrationManager(ILogger bootstrappingLogger, IServiceCollection services, ITestRunReporterContext testRunReporterContext) { _bootstrappingLogger = bootstrappingLogger ?? throw new ArgumentNullException(nameof(bootstrappingLogger)); _services = services ?? throw new ArgumentNullException(nameof(services)); _testRunReporterContext = testRunReporterContext ?? throw new ArgumentNullException(nameof(testRunReporterContext)); RefreshRegistrationState(); }
internal ManagerUnderTestBuilder() { _services = new ServiceCollection(); WithNoRegisteredServices(); _logger = NSubstitute.Substitute.For <ILogger>(); _testRunExecutionContext = NSubstitute.Substitute.For <ITestRunReporterContext>(); }
private static void RegisterExtentReporting(string prefix, IServiceCollection serviceCollection, ITestRunReporterContext testRunReporterContext) { if (!testRunReporterContext.InstrumentationSettings.ReportingSettings.Enabled) { return; } var testRunReporter = new TestRunReporter(testRunReporterContext.RootReportingFolder, testRunReporterContext.TestRunIdentity); serviceCollection.AddSingleton <ITestRunReporter>(isp => { return(testRunReporter); }); serviceCollection.AddScoped <ITestCaseReporterContext>(isp => { return(new TestCaseReporterContext(rootOutputFolder: testRunReporter.ReportOutputFolder, testCaseIdentity: $"{DateTime.Now.ToString("yyyyMMddHHmmssfff")}")); }); serviceCollection.AddScoped(isp => { var testRunReporter = isp.GetRequiredService <ITestRunReporter>(); var testCaseReporterContext = isp.GetRequiredService <ITestCaseReporterContext>(); var logger = isp.GetRequiredService <ILogger>(); var result = testRunReporter.CreateTestCaseReporter(logger, testCaseReporterContext); result.AlwaysCaptureScreenshots = testRunReporterContext.InstrumentationSettings.ReportingSettings.AlwaysCaptureScreenshots; return(result); }); }
private static void UseDefaultReportingContexts(string prefix, IServiceCollection serviceCollection, ITestRunReporterContext testRunReporterContext) { // By doing nothing, the container will be populated with the default services. }