public static IServiceCollection Main() { StaticLog.Initialize(); var disConfig = new DiscordSocketConfig { AlwaysDownloadUsers = true, LargeThreshold = 250, MessageCacheSize = 10000, GatewayIntents = GatewayIntents.All ^ GatewayIntents.GuildInvites ^ GatewayIntents.GuildScheduledEvents, }; return(ConfigurePartialServiceCollection(disConfig)); }
private static IReporter InitializeReporter(ReporterSettings settings, ITestDataProvider testDataProvider) { if (settings.OutputPath == null) { throw new ArgumentNullException(nameof(settings.OutputPath), "Reporter Output path must be specified. Please fix your .json settings file."); } StaticLog.Initialize(settings.OutputPath); var uri = new Uri(typeof(ReporterFactory).Assembly.CodeBase); var dataServiceAssemblyFullPath = Path.Combine(Path.GetDirectoryName(uri.LocalPath) ?? "", settings.DataServiceFile); var dataServiceAssembly = Assembly.LoadFrom(dataServiceAssemblyFullPath); var dataServiceType = dataServiceAssembly.GetTypes() .FirstOrDefault(t => typeof(IDataService).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract); if (dataServiceType == null) { throw new NullReferenceException($"Can't find implementation of {nameof(IDataService)} in {settings.DataServiceFile} file. " + "Please fix your .json settings file."); } var dataService = Activator.CreateInstance(dataServiceType) as IDataService; if (dataService == null) { throw new NullReferenceException($"Can't find create instance of type {nameof(dataServiceType)} from {settings.DataServiceFile} file. " + "Please fix your .json settings file."); } dataService.Initialize(settings); var reporter = new Reporter { Action = new ActionHelper(settings.OutputPath), TestDataProvider = testDataProvider, ReporterSettings = settings, ReportSettings = new ReportSettingsDto(settings.RunsToDisplay, settings.TestsToDisplay), DataService = dataService, RunRepository = new RunDtoRepository(), TestRunsRepository = new TestRunsRepository(), TestRunProcessor = new TestRunDtoProcessor(), TestRunStarted = false }; return(reporter); }
static GhprTestAttribute() { Reporter = new Reporter(TestingFramework.NUnit); StaticLog.Initialize(Reporter.Settings.OutputPath); }
static GhprTestAttribute() { Reporter = ReporterFactory.Build(TestingFramework.NUnit, new TestDataProvider()); StaticLog.Initialize(Reporter.ReporterSettings.OutputPath); }
static GhprEventListener() { Reporter = new Reporter(TestingFramework.NUnit); StaticLog.Initialize(Reporter.Settings.OutputPath); }