public void ReadMultipleFrameworks()
        {
            var config = RuntimeConfiguration.FromJson(@"{
    ""runtimeOptions"": {
        ""tfm"": ""net5.0"",
        ""includedFrameworks"": [
            {
                ""name"": ""Microsoft.NETCore.App"",
                ""version"": ""5.0.0""
            },
            {
                ""name"": ""Microsoft.WindowsDesktop.App"",
                ""version"": ""5.0.0""
            }
        ]
    }
}");

            Assert.NotNull(config.RuntimeOptions);
            Assert.Equal("net5.0", config.RuntimeOptions.TargetFrameworkMoniker);

            var frameworks = config.RuntimeOptions.IncludedFrameworks;

            Assert.Contains(frameworks, framework => framework.Name == "Microsoft.NETCore.App" &&
                            framework.Version == "5.0.0");
            Assert.Contains(frameworks, framework => framework.Name == "Microsoft.WindowsDesktop.App" &&
                            framework.Version == "5.0.0");
        }
        public void Create(WeatherForecast model)
        {
            var connectionString = RuntimeConfiguration.GetConnectionString("WeatherContext");

            using var adapter = new DataAccessAdapter(connectionString);
            var metaData = new LinqMetaData(adapter);
        }
Example #3
0
 public void RegisterCustomizations(ObjectContainer container, RuntimeConfiguration runtimeConfiguration)
 {
     if (runtimeConfiguration.StopAtFirstError)
     {
         container.RegisterTypeAs <CustomTestRunnerFactory, ITestRunnerFactory>();
     }
 }
Example #4
0
        public static void AssemblyInit(TestContext context)
        {
            var configuration = new ConfigurationBuilder().SetBasePath(AppContext.BaseDirectory).AddJsonFile("appsettings.json").Build();
            var sqlServerConnectionString = configuration.GetSection("ConnectionStrings")["SqlServerTestDatabase"];
            RuntimeConfiguration.AddConnectionString("ConnectionString.SQL Server (SqlClient)", sqlServerConnectionString);
	
// change to TRUE to have ORM Profiler monitoring. Won't work with Connection Sharing.  
#if FALSE			
            // Wrap the factory with a factory from the ORM Profiler so we get real time information about what's going on
            // ORM Profiler is a free tool for LLBLGen Pro subscribers.
            RuntimeConfiguration.ConfigureDQE<SQLServerDQEConfiguration>(c => c.AddDbProviderFactory(InterceptorCore.Initialize("ORM Cookbook",
                                                                                                     typeof(Microsoft.Data.SqlClient.SqlClientFactory)))
                                                                               .SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012));
#else
			RuntimeConfiguration.ConfigureDQE<SQLServerDQEConfiguration>(c => c.AddDbProviderFactory(typeof(Microsoft.Data.SqlClient.SqlClientFactory))
#endif
																			   .SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012));
            RuntimeConfiguration.Entity.SetMarkSavedEntitiesAsFetched(true);
			// Setup the dependency injection system to auto-inject e.g. auditors when needed. 
			RuntimeConfiguration.SetDependencyInjectionInfo(new List<Assembly>() { typeof(DepartmentAuditor).Assembly}, null);
			
            try
            {
                (new Setup()).Warmup();
            }
            catch { }
        }
Example #5
0
        private void ConfigureLlblgenPro()
        {
            var dbContextList = DbContextList.DeserializeFromFile(Path.Combine(WebHostEnvironment.ContentRootPath, Program.ConfigurationFolder, $"DbContextList.{WebHostEnvironment.EnvironmentName}.config"));

            foreach (var dbContext in dbContextList)
            {
                var connectionString = Configuration.GetConnectionString(dbContext.ConnectionKey);
                RuntimeConfiguration.AddConnectionString(dbContext.ConnectionKey, connectionString);
                // Enable low-level (result set) caching when specified in selected queries
                // The cache of a query can be overwritten using property 'OverwriteIfPresent'
                CacheController.RegisterCache(connectionString, new ResultsetCache());
                CacheController.CachingEnabled = true;
            }

            //RuntimeConfiguration.SetDependencyInjectionInfo(new[] { typeof(TournamentManager.EntityValidators.UserEntityValidator).Assembly }, new[] { "TournamentManager.Validators" });

            if (WebHostEnvironment.IsProduction())
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Off)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
            }
            else
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Verbose)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));

                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPersistenceExecution", TraceLevel.Verbose);
                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPlainSQLQueryExecution", TraceLevel.Verbose);
            }
        }
Example #6
0
 public TestRunnerManager(IObjectContainer globalContainer, ITestRunContainerBuilder testRunContainerBuilder, RuntimeConfiguration runtimeConfiguration, IRuntimeBindingRegistryBuilder bindingRegistryBuilder)
 {
     this.globalContainer         = globalContainer;
     this.testRunContainerBuilder = testRunContainerBuilder;
     this.runtimeConfiguration    = runtimeConfiguration;
     this.bindingRegistryBuilder  = bindingRegistryBuilder;
 }
        /// <summary>
        /// Load native modules (i.e. DAC, DBI) from the runtime build id.
        /// </summary>
        /// <param name="callback">called back for each symbol file loaded</param>
        /// <param name="parameter">callback parameter</param>
        /// <param name="config">Target configuration: Windows, Linux or OSX</param>
        /// <param name="moduleFilePath">module path</param>
        /// <param name="specialKeys">if true, returns the DBI/DAC keys, otherwise the identity key</param>
        /// <param name="moduleIndexSize">build id size</param>
        /// <param name="moduleIndex">pointer to build id</param>
        private void LoadNativeSymbolsFromIndex(
            IntPtr self,
            SymbolFileCallback callback,
            IntPtr parameter,
            RuntimeConfiguration config,
            string moduleFilePath,
            bool specialKeys,
            int moduleIndexSize,
            IntPtr moduleIndex)
        {
            if (_symbolService.IsSymbolStoreEnabled)
            {
                try
                {
                    KeyTypeFlags flags = specialKeys ? KeyTypeFlags.DacDbiKeys : KeyTypeFlags.IdentityKey;
                    byte[]       id    = new byte[moduleIndexSize];
                    Marshal.Copy(moduleIndex, id, 0, moduleIndexSize);

                    IEnumerable <SymbolStoreKey> keys = null;
                    switch (config)
                    {
                    case RuntimeConfiguration.UnixCore:
                        keys = ELFFileKeyGenerator.GetKeys(flags, moduleFilePath, id, symbolFile: false, symbolFileName: null);
                        break;

                    case RuntimeConfiguration.OSXCore:
                        keys = MachOFileKeyGenerator.GetKeys(flags, moduleFilePath, id, symbolFile: false, symbolFileName: null);
                        break;

                    case RuntimeConfiguration.WindowsCore:
                    case RuntimeConfiguration.WindowsDesktop:
                        uint           timeStamp = BitConverter.ToUInt32(id, 0);
                        uint           fileSize  = BitConverter.ToUInt32(id, 4);
                        SymbolStoreKey key       = PEFileKeyGenerator.GetKey(moduleFilePath, timeStamp, fileSize);
                        keys = new SymbolStoreKey[] { key };
                        break;

                    default:
                        Trace.TraceError("LoadNativeSymbolsFromIndex: unsupported platform {0}", config);
                        return;
                    }
                    foreach (SymbolStoreKey key in keys)
                    {
                        string moduleFileName = Path.GetFileName(key.FullPathName);
                        Trace.TraceInformation("{0} {1}", key.FullPathName, key.Index);

                        string downloadFilePath = _symbolService.DownloadFile(key);
                        if (downloadFilePath != null)
                        {
                            Trace.TraceInformation("{0}: {1}", moduleFileName, downloadFilePath);
                            callback(parameter, moduleFileName, downloadFilePath);
                        }
                    }
                }
                catch (Exception ex) when(ex is BadInputFormatException || ex is InvalidVirtualAddressException || ex is TaskCanceledException)
                {
                    Trace.TraceError("{0} - {1}", ex.Message, moduleFilePath);
                }
            }
        }
Example #8
0
 public GlobalService()
 {
     GlobalCharacteristics = Characteristic.GlobalCharacteristics;
     GlobalTypes           = Type.GlobalTypes;
     PreviewNotePlayers    = PreviewNotePlayer.PreviewNotePlayers;
     RuntimeConfiguration  = new RuntimeConfiguration();
 }
Example #9
0
        public void ResolveWithConfiguredRuntimeWindowsResolvesRightWindowsBase()
        {
            Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), NonWindowsPlatform);

            var assemblyRef = new AssemblyReference(
                "WindowsBase",
                new Version(4, 0, 0, 0),
                false,
                new byte[] { 0x31, 0xbf, 0x38, 0x56, 0xad, 0x36, 0x4e, 0x35 });

            var config      = RuntimeConfiguration.FromJson(@"{
    ""runtimeOptions"": {
        ""tfm"": ""netcoreapp3.1"",
        ""framework"": {
            ""name"": ""Microsoft.WindowsDesktop.App"",
            ""version"": ""3.1.0""
        }
    }
}");
            var resolver    = new DotNetCoreAssemblyResolver(config, new Version(3, 1, 0));
            var assemblyDef = resolver.Resolve(assemblyRef);

            Assert.NotNull(assemblyDef);
            Assert.Equal("WindowsBase", assemblyDef.Name);
            Assert.NotNull(assemblyDef.ManifestModule.FilePath);
            Assert.Contains("Microsoft.WindowsDesktop.App", assemblyDef.ManifestModule.FilePath);
        }
Example #10
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            AddSerilogLogger();

            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            AqarPress.Core.Init.Empty();

            var types = AppDomain.CurrentDomain.GetAssemblies()
                        .SelectMany(x => x.GetTypes())
                        .Where(p => typeof(ICreateInScope).IsAssignableFrom(p) && p.IsClass)
                        .ToList();

            types.ForEach(x => services.AddSingleton(x));

            RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(
                c => c.SetTraceLevel(TraceLevel.Verbose)
                .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory))
                .SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012));
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();
            app.UseCors("AllowCors");


            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });



            RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(c => c.AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
            RuntimeConfiguration.AddConnectionString(Configuration["ConnectionStrings:StringKey"], Configuration["ConnectionStrings:DefaultConnection"]);
            RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(c => c.SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012));
            RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(c => c.AddCatalogNameOverwrite("HARS_Susmita", Configuration["ConnectionStrings:CatalogNameToUse"]));
        }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LLBLGenProNormalBencher"/> class.
 /// </summary>
 public LLBLGenProNormalBencher(string connectionString)
     : base(e => e.SalesOrderId, l => l.CreditCardId, usesChangeTracking: true, usesCaching: false, supportsEagerLoading: true, supportsAsync: true, supportsInserts: true)
 {
     EntityBase2.MarkSavedEntitiesAsFetched = true;
     RuntimeConfiguration.AddConnectionString("AdventureWorks.ConnectionString.SQL Server (SqlClient)", connectionString);
     RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(c => c.AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
 }
Example #13
0
        private void ConfigureLLBLGenPro(IServiceCollection services)
        {
            var llblgenProConfig = new LLBLGenProConfiguration();

            _configuration.Bind("LLBLGenPro", llblgenProConfig);
            llblgenProConfig.Sanitize();
            var connectionString = _configuration.GetConnectionString("Main.ConnectionString.SQL Server (SqlClient)");

            if (!string.IsNullOrEmpty(connectionString) !)
            {
                RuntimeConfiguration.AddConnectionString("Main.ConnectionString.SQL Server (SqlClient)", connectionString);
            }

            foreach (var kvp in llblgenProConfig.ConnectionStrings)
            {
                RuntimeConfiguration.AddConnectionString(kvp.Key, kvp.Value);
            }

            var factoryType = typeof(Microsoft.Data.SqlClient.SqlClientFactory);

#if DEBUG
            // only intercept queries using the profiler in debug builds.
            factoryType = InterceptorCore.Initialize("HnD", factoryType);
#endif
            RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(c =>
            {
                c.AddDbProviderFactory(factoryType)
                .SetDefaultCompatibilityLevel(llblgenProConfig.SqlServerCompatibilityAsEnum);

                foreach (var kvp in llblgenProConfig.CatalogNameOverwrites)
                {
                    c.AddCatalogNameOverwrite(kvp.Key, kvp.Value);
                }
            });
        }
Example #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            RuntimeConfiguration.AddConnectionString("ConnectionString.SQL Server (SqlClient)", @"data source=DESKTOP-K7BKMEJ\SQLEXPRESS;initial catalog=Vehicle;integrated security=SSPI;persist security info=False;packet size=4096");
            RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(
                c => c.SetTraceLevel(TraceLevel.Verbose)
                .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory))
                .SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012));

            RuntimeConfiguration.Tracing
            .SetTraceLevel("ORMPersistenceExecution", TraceLevel.Info);
            RuntimeConfiguration.Entity
            .SetMarkSavedEntitiesAsFetched(true);

            app.UseCors(options => options.WithOrigins().AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin());
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=VehicleMake}/{action=Index}/{id?}");
            });
        }
Example #15
0
 public TestTracer(ITraceListener traceListener, IStepFormatter stepFormatter, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, RuntimeConfiguration runtimeConfiguration)
 {
     this.traceListener = traceListener;
     this.stepFormatter = stepFormatter;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.runtimeConfiguration           = runtimeConfiguration;
 }
Example #16
0
        public void ResolveWithConfiguredRuntime()
        {
            var assemblyName = typeof(object).Assembly.GetName();
            var assemblyRef  = new AssemblyReference(
                assemblyName.Name,
                assemblyName.Version,
                false,
                assemblyName.GetPublicKeyToken());

            var config      = RuntimeConfiguration.FromJson(@"{
    ""runtimeOptions"": {
        ""tfm"": ""netcoreapp3.1"",
        ""framework"": {
            ""name"": ""Microsoft.NETCore.App"",
            ""version"": ""3.1.0""
        }
    }
}");
            var resolver    = new DotNetCoreAssemblyResolver(config, new Version(3, 1, 0));
            var assemblyDef = resolver.Resolve(assemblyRef);

            Assert.NotNull(assemblyDef);
            Assert.Equal(assemblyName.Name, assemblyDef.Name);
            Assert.NotNull(assemblyDef.ManifestModule.FilePath);
            Assert.Contains("Microsoft.NETCore.App", assemblyDef.ManifestModule.FilePath);
        }
        public void Setup()
        {
            skeletonProviders = new Dictionary <ProgrammingLanguage, IStepDefinitionSkeletonProvider>();
            skeletonProviders.Add(ProgrammingLanguage.CSharp, new Mock <IStepDefinitionSkeletonProvider>().Object);

            var culture = new CultureInfo("en-US");

            contextManagerStub = new Mock <IContextManager>();
            scenarioContext    = new ScenarioContext(new ScenarioInfo("scenario_title"), null, null);
            contextManagerStub.Setup(cm => cm.ScenarioContext).Returns(scenarioContext);
            contextManagerStub.Setup(cm => cm.FeatureContext).Returns(new FeatureContext(new FeatureInfo(culture, "feature_title", "", ProgrammingLanguage.CSharp), culture));

            bindingRegistryStub = new Mock <IBindingRegistry>();
            bindingRegistryStub.Setup(br => br.GetEvents(BindingEvent.StepStart)).Returns(beforeStepEvents);
            bindingRegistryStub.Setup(br => br.GetEvents(BindingEvent.StepEnd)).Returns(afterStepEvents);
            bindingRegistryStub.Setup(br => br.GetEvents(BindingEvent.BlockStart)).Returns(beforeScenarioBlockEvents);
            bindingRegistryStub.Setup(br => br.GetEvents(BindingEvent.BlockEnd)).Returns(afterScenarioBlockEvents);

            runtimeConfiguration      = new RuntimeConfiguration();
            errorProviderStub         = new Mock <IErrorProvider>();
            testTracerStub            = new Mock <ITestTracer>();
            stepDefinitionMatcherStub = new Mock <IStepDefinitionMatcher>();

            stepErrorHandlers = new Dictionary <string, IStepErrorHandler>();
        }
Example #18
0
        public void ResolveWithConfiguredRuntimeWindowsCanStillResolveCorLib()
        {
            Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), NonWindowsPlatform);

            var assemblyName = typeof(object).Assembly.GetName();
            var assemblyRef  = new AssemblyReference(
                assemblyName.Name,
                assemblyName.Version,
                false,
                assemblyName.GetPublicKeyToken());

            var config      = RuntimeConfiguration.FromJson(@"{
    ""runtimeOptions"": {
        ""tfm"": ""netcoreapp3.1"",
        ""framework"": {
            ""name"": ""Microsoft.WindowsDesktop.App"",
            ""version"": ""3.1.0""
        }
    }
}");
            var resolver    = new DotNetCoreAssemblyResolver(config, new Version(3, 1, 0));
            var assemblyDef = resolver.Resolve(assemblyRef);

            Assert.NotNull(assemblyDef);
            Assert.Equal(assemblyName.Name, assemblyDef.Name);
            Assert.NotNull(assemblyDef.ManifestModule.FilePath);
        }
Example #19
0
        private void ConfigureLlblgenPro(TenantStore tenantStore)
        {
            foreach (var tenant in tenantStore.GetTenants().Values)
            {
                var connectionString = Configuration.GetConnectionString(tenant.DbContext.ConnectionKey);
                RuntimeConfiguration.AddConnectionString(tenant.DbContext.ConnectionKey, connectionString);
                // Enable low-level (result set) caching when specified in selected queries
                // The cache of a query can be overwritten using property 'OverwriteIfPresent'
                CacheController.RegisterCache(connectionString, new ResultsetCache());
                CacheController.CachingEnabled = true;
            }

            if (WebHostEnvironment.IsProduction())
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Off)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
            }
            else
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Verbose)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));

                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPersistenceExecution", TraceLevel.Verbose);
                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPlainSQLQueryExecution", TraceLevel.Verbose);
            }
        }
Example #20
0
 public llbl()
 {
     RuntimeConfiguration.ConfigureDQE <SQLServerDQEConfiguration>(
         c => c.AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
     RuntimeConfiguration.AddConnectionString
         ("ConnectionString.SQL Server (SqlClient)", "data source=DESKTOP-CUE6HRC;initial catalog=llbl; Integrated Security=SSPI");
 }
        public void Setup()
        {
            stepDefinitionSkeletonProviderMock = new Mock <IStepDefinitionSkeletonProvider>();

            var culture = new CultureInfo("en-US");

            contextManagerStub = new Mock <IContextManager>();
            scenarioContext    = new ScenarioContext(new ObjectContainer(), new ScenarioInfo("scenario_title"), new BindingInstanceResolver());
            contextManagerStub.Setup(cm => cm.ScenarioContext).Returns(scenarioContext);
            contextManagerStub.Setup(cm => cm.FeatureContext).Returns(new FeatureContext(new FeatureInfo(culture, "feature_title", "", ProgrammingLanguage.CSharp), culture));

            bindingRegistryStub = new Mock <IBindingRegistry>();
            bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeStep)).Returns(beforeStepEvents);
            bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterStep)).Returns(afterStepEvents);
            bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeScenarioBlock)).Returns(beforeScenarioBlockEvents);
            bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterScenarioBlock)).Returns(afterScenarioBlockEvents);

            runtimeConfiguration      = new RuntimeConfiguration();
            errorProviderStub         = new Mock <IErrorProvider>();
            testTracerStub            = new Mock <ITestTracer>();
            stepDefinitionMatcherStub = new Mock <IStepDefinitionMatchService>();
            methodBindingInvokerMock  = new Mock <IBindingInvoker>();

            stepErrorHandlers = new Dictionary <string, IStepErrorHandler>();
        }
Example #22
0
        public static void Main(string[] args)
        {
            RuntimeConfiguration runtimeConfiguration = new RuntimeConfiguration();

            // For now run in standalone mode.
            RunStandalone(runtimeConfiguration);
        }
Example #23
0
        /// <summary>
        /// Creates a new <see cref="MainViewModel"/>.
        /// </summary>
        public MainViewModel(RuntimeConfiguration configuration)
        {
            Configuration = configuration;
            Configuration.ConsoleWriter = new SourceStream <string>();
            ConsoleList = new ObservableCollection <string>();
            Configuration.ConsoleWriter.BindResult(t => Dispatchers.RunOnUIThreadAsync(() => ConsoleList.Add(t)));

            FileList = new ObservableCollection <string>();

            var open = new StreamCommand(OpenCommand);

            open.BindResult(o => Dispatchers.RunOnUIThreadAsync(() => OpenFolder()));

            var select = new StreamCommand <string>(SelectCommand);

            select.BindResult(o => Dispatchers.RunOnUIThreadAsync(() => LoadFile(o)));

            var start = new StreamCommand(StartCommand);

            start.BindResult(b => Task.Run(StartProcess));

            Commands = new List <ICommand>()
            {
                open,
                select,
                start
            };
        }
Example #24
0
        public static void RunStandalone(RuntimeConfiguration runtimeConfiguration)
        {
            bool shouldRun = true;
            // Create a manager thread.
            Manager manager = new Manager(runtimeConfiguration);

            // Setup the Manager thread.
            manager.Setup(runtimeConfiguration);
            // Start the Manager service thread.
            Task managerThread = Task.Run(() => manager.RunAsync());

            // Wait a few seconds for the manager to get set up.
            Thread.Sleep(1000);

            // Set up the workers.
            WorkerPool workerPool = new WorkerPool(runtimeConfiguration);

            workerPool.SetupAllWorkers(runtimeConfiguration);
            workerPool.RunAllWorkersAsync();
            Console.CancelKeyPress += (s, e) =>
            {
                runtimeConfiguration.GetLoggerInstance().Error("Runner", "Overwatch", "Console kill command received. Forcing shutdown.");
                workerPool.KillAllWorkers();
                shouldRun = false;
            };
            Task.WaitAll(managerThread);
        }
Example #25
0
        public void Create(Animal animal)
        {
            var connectionString = RuntimeConfiguration.GetConnectionString("AnimalContext");

            using var adapter = new DataAccessAdapter(connectionString);
            if (animal.GetType().IsSubclassOf(typeof(Animal)))
            {
                switch (animal)
                {
                case Dog:
                    adapter.SaveEntity(new DogEntity
                    {
                        Name = animal.Name,
                        Type = (int)animal.Type
                    });
                    break;

                case Cow:
                    adapter.SaveEntity(new CowEntity
                    {
                        Name = animal.Name,
                        Type = (int)animal.Type
                    });
                    break;
                }
            }
            else
            {
                adapter.SaveEntity(new AnimalEntity
                {
                    Name = animal.Name,
                    Type = (int)animal.Type
                });
            }
        }
Example #26
0
 public BindingInvoker(RuntimeConfiguration runtimeConfiguration,
                       IErrorProvider errorProvider,
                       IHookRegistry hookRegistry)
 {
     _hookRegistry  = hookRegistry;
     _targetInvoker = new TechTalk.SpecFlow.Bindings.BindingInvoker(runtimeConfiguration, errorProvider);
 }
        public IEnumerable <KeyValuePair <string, string> > GetTraits(IAttributeInfo traitAttribute)
        {
            if (!DiscovererHelpers.IsMonoRuntime)
            {
                TestPlatforms        testPlatforms         = TestPlatforms.Any;
                RuntimeTestModes     stressMode            = RuntimeTestModes.Any;
                RuntimeConfiguration runtimeConfigurations = RuntimeConfiguration.Any;
                foreach (object arg in traitAttribute.GetConstructorArguments().Skip(1)) // We skip the first one as it is the reason
                {
                    if (arg is TestPlatforms tp)
                    {
                        testPlatforms = tp;
                    }
                    else if (arg is RuntimeTestModes rtm)
                    {
                        stressMode = rtm;
                    }
                    else if (arg is RuntimeConfiguration rc)
                    {
                        runtimeConfigurations = rc;
                    }
                }

                if (DiscovererHelpers.TestPlatformApplies(testPlatforms) && RuntimeConfigurationApplies(runtimeConfigurations) && StressModeApplies(stressMode))
                {
                    return(new[] { new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.Failing) });
                }
            }

            return(Array.Empty <KeyValuePair <string, string> >());
        }
Example #28
0
 public GhprTestExecutionEngine(
     IStepFormatter stepFormatter,
     ITestTracer testTracer,
     IErrorProvider errorProvider,
     IStepArgumentTypeConverter stepArgumentTypeConverter,
     RuntimeConfiguration runtimeConfiguration,
     IBindingRegistry bindingRegistry,
     IUnitTestRuntimeProvider unitTestRuntimeProvider,
     IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider,
     IContextManager contextManager,
     IStepDefinitionMatchService stepDefinitionMatchService,
     IDictionary <string, IStepErrorHandler> stepErrorHandlers,
     IBindingInvoker bindingInvoker)
 {
     _engine = new TestExecutionEngine(stepFormatter,
                                       testTracer,
                                       errorProvider,
                                       stepArgumentTypeConverter,
                                       runtimeConfiguration,
                                       bindingRegistry,
                                       unitTestRuntimeProvider,
                                       stepDefinitionSkeletonProvider,
                                       contextManager,
                                       stepDefinitionMatchService,
                                       stepErrorHandlers,
                                       bindingInvoker);
     _reporter = new Reporter(TestingFramework.SpecFlow);
 }
Example #29
0
        public SpecflowManager(string assemblyPath, ILogger logger)
        {
            ConfigurationManager.AppSettings["SmtpServerEnabled"] = "false";

            //CoreExtensions.Host.InitializeService();
            this.testAssembly = Assembly.LoadFrom(assemblyPath);

            this.testRunner = this.InitTestRunner();

            this.executionEngine         = this.testRunner.GetMemberValue <TestExecutionEngine>("executionEngine");
            this.bindingRegistry         = this.executionEngine.GetMemberValue <IBindingRegistry>("bindingRegistry");
            this.unitTestRuntimeProvider = this.executionEngine.GetMemberValue <IUnitTestRuntimeProvider>("unitTestRuntimeProvider");
            this.contextManager          = this.executionEngine.GetMemberValue <IContextManager>("contextManager");
            this.runtimeConfiguration    = this.executionEngine.GetMemberValue <RuntimeConfiguration>("runtimeConfiguration");
            this.defaultTargetLanguage   = this.executionEngine.GetMemberValue <ProgrammingLanguage>("defaultTargetLanguage");
            this.defaultBindingCulture   = this.executionEngine.GetMemberValue <CultureInfo>("defaultBindingCulture");

            var core = this.testAssembly.GetReferencedAssemblies().First(a => a.FullName.Contains("Wilco.UITest.Core"));

            this.webBrowser      = Assembly.Load(core).GetTypes().First(t => t.Name.Contains("WebBrowser"));
            this.globalContainer = this.testRunnerManager.GetMemberValue <ObjectContainer>("globalContainer");
            if (logger != null)
            {
                this.logger = logger;
                this.RegistrLogger(logger);
            }
            //this.Bind(this.testAssembly);
        }
Example #30
0
 /// <summary>
 /// Initializes the pool with default settings and binds to the active
 /// Logger output.
 /// </summary>
 /// <param name="runtimeConfiguration">Active configuration settings for the current session.</param>
 public WorkerRegistrationPool(RuntimeConfiguration runtimeConfiguration)
 {
     this.runtimeConfiguration = runtimeConfiguration;
     registrationPool          = new List <WorkerRegistration>();
     hostAddress = runtimeConfiguration.GetManagerBindAddress();
     basePort    = runtimeConfiguration.GetManagerComPort() + 1;
 }