Example #1
0
        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));
        }
Example #2
0
        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);
        }
Example #3
0
 static GhprTestAttribute()
 {
     Reporter = new Reporter(TestingFramework.NUnit);
     StaticLog.Initialize(Reporter.Settings.OutputPath);
 }
Example #4
0
 static GhprTestAttribute()
 {
     Reporter = ReporterFactory.Build(TestingFramework.NUnit, new TestDataProvider());
     StaticLog.Initialize(Reporter.ReporterSettings.OutputPath);
 }
Example #5
0
 static GhprEventListener()
 {
     Reporter = new Reporter(TestingFramework.NUnit);
     StaticLog.Initialize(Reporter.Settings.OutputPath);
 }