示例#1
0
        public static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("nl-NL");
            ConfigurationFactory configurationFactory = new ConfigurationFactory();
            Configuration configuration = configurationFactory.Create();
            if (configuration == null)
            {
                // Newly created.
                return;
            }

            Application.Init();

            if (!authenticate())
            {
                return;
            }

            IDbConnection connection = new ConnectionFactory().createConnection(configuration.ConnectionString);

            IRepositoryFactory repositoryFactory = new RepositoryFactory(connection);

            new MainWindow(repositoryFactory).Show();

            Application.Run();
        }
示例#2
0
        static void Main(string[] args)
        {
            var rand = new Random();

            var paramsProvider = new AppConfigProvider(ConfigurationManager.AppSettings);
            var configProvider = new ConfigurationProvider();
            var configFactory = new ConfigurationFactory(new ClientParams(paramsProvider), configProvider);

            var clientConfig = configFactory.Create<ClientConfiguration>();
            clientConfig.Port = rand.Next()%1000 + 25000;

            LogManager.Debug("Address is : 127.0.0.1:{0}", clientConfig.Port);

            var client = new Client(clientConfig);

            client.Start(Console.ReadLine(), () =>
            {
                var small = SmallTestObject.Create();
                while (true)
                {
                    var key = Console.ReadKey();
                    if (key.Key == ConsoleKey.Enter)
                        break;

                    small.Message = key.KeyChar.ToString();
                    client.SendObject(small);
                }
            });
        }
示例#3
0
        static void Main(string[] args)
        {
            var paramsProvider = new AppConfigProvider(ConfigurationManager.AppSettings);
            var configProvider = new ConfigurationProvider();

            var factory = new ConfigurationFactory(new ServerParams(paramsProvider), configProvider);

            using(var server = new Server(factory.Create<ServerConfiguration>()))
                server.Listen();
        }
 public static _Configuration OpenMappedMachineConfiguration(ConfigurationFileMap fileMap)
 {
     return(ConfigurationFactory.Create(typeof(WebConfigurationHost), fileMap));
 }
 public static _Configuration OpenMappedWebConfiguration(WebConfigurationFileMap fileMap, string path, string site, string locationSubPath)
 {
     return(ConfigurationFactory.Create(typeof(WebConfigurationHost), fileMap, path, site, locationSubPath));
 }
示例#6
0
 private static void ConfigureOptions(IServiceCollection serviceCollection)
 {
     Configuration = ConfigurationFactory.Create(Directory.GetCurrentDirectory());
 }
示例#7
0
文件: Hooks.cs 项目: drsslv/Molder
        public void BeforeScenario(FeatureContext feature, ScenarioContext scenario)
        {
            ConfigurationExtension.Instance.Configuration = ConfigurationExtension.Instance.Configuration ?? ConfigurationFactory.Create(BinDirectory);
            config.Value = ConfigOptionsFactory.Create(ConfigurationExtension.Instance.Configuration);

            var tags = TagHelper.GetTagsBy(scenario);

            controller.AddConfig(config.Value, tags);
        }
示例#8
0
文件: Hooks.cs 项目: drsslv/Molder
        public static void BeforeFeature(FeatureContext featureContext, VariableController variableController)
        {
            ConfigurationExtension.Instance.Configuration = ConfigurationExtension.Instance.Configuration ?? ConfigurationFactory.Create(BinDirectory);
            config.Value = ConfigOptionsFactory.Create(ConfigurationExtension.Instance.Configuration);

            var tags = TagHelper.GetTagsBy(featureContext);

            variableController.AddConfig(config.Value, tags);
        }
示例#9
0
 public InitialDataTests()
 {
     context = new Context(ConfigurationFactory.Create());
 }
示例#10
0
        public static Configuration OpenMachineConfiguration()
        {
            ConfigurationFileMap map = new ConfigurationFileMap();

            return(ConfigurationFactory.Create(typeof(MachineConfigurationHost), map));
        }
示例#11
0
 public static Configuration OpenMappedExeConfiguration(ExeConfigurationFileMap fileMap, ConfigurationUserLevel userLevel)
 {
     return(ConfigurationFactory.Create(typeof(ExeConfigurationHost), fileMap, userLevel));
 }
示例#12
0
 public void Create_ShouldReturnConfigurationXml()
 {
     Assert.IsInstanceOf <ConfigurationXml>(mSut.Create("filename"));
 }
 static ResourcesTests()
 {
     using (Configuration configuration = new Configuration(new Context(ConfigurationFactory.Create()), new Context(ConfigurationFactory.Create())))
         configuration.UpdateDatabase();
 }
 public TestingContext(String databaseName)
     : base(ConfigurationFactory.Create())
 {
     DatabaseName = databaseName ?? Guid.NewGuid().ToString();
 }
        public void SetupInfrastructure()
        {
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                    .AddEnvironmentVariables()
                                    .Build();

            var configFactory = new ConfigurationFactory(config);

            ObjectContainer.RegisterInstanceAs(configFactory.Create <MovieLoggerConfig>());
            ObjectContainer.RegisterInstanceAs(configFactory.Create <ImageLoggingConfig>());

            Register(new FileManager(new DatetimeManager(() => DateTime.Now)));
            ImageLogging = new ImageLogging(ObjectContainer.Resolve <ImageLoggingConfig>());
            MovieLogger  = new MovieLogger(FileManager, ObjectContainer.Resolve <MovieLoggerConfig>(), Metadata);

            ObjectContainer.RegisterInstanceAs(ImageLogging);
            ObjectContainer.RegisterInstanceAs(MovieLogger);

            var logger = new DefaultLogger(new DirectoryInfo(Environment.CurrentDirectory));

            Register((PossumLabs.Specflow.Core.Logging.ILog)logger);
            Register <ElementFactory>(new ElementFactory());
            Register <XpathProvider>(new XpathProvider());
            Register <SelectorFactory>(new SelectorFactory(ElementFactory, XpathProvider).UseBootstrap());
            Register(new PossumLabs.Specflow.Selenium.WebDriverManager(
                         this.Interpeter,
                         this.ObjectFactory,
                         new SeleniumGridConfiguration()));


            FileManager.Initialize(FeatureContext.FeatureInfo.Title, ScenarioContext.ScenarioInfo.Title, null /*Specflow limitation*/);

            var templateManager = new PossumLabs.Specflow.Core.Variables.TemplateManager();

            templateManager.Initialize(Assembly.GetExecutingAssembly());
            Register(templateManager);

            Log.Message($"feature: {FeatureContext.FeatureInfo.Title} scenario: {ScenarioContext.ScenarioInfo.Title} \n" +
                        $"Tags: {FeatureContext.FeatureInfo.Tags.LogFormat()} {ScenarioContext.ScenarioInfo.Tags.LogFormat()}");

            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

            WebDriverManager.Initialize(BuildDriver);
            WebDriverManager.WebDriverFactory = () =>
            {
                var options = new ChromeOptions();
                // https://stackoverflow.com/questions/22322596/selenium-error-the-http-request-to-the-remote-webdriver-timed-out-after-60-sec?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
                options.AddArgument("no-sandbox"); //might be a fix :/
                options.AddArgument("disable-popup-blocking");
                options.AddArgument("disable-gpu");
                options.AddArgument("disable-extensions");
                options.AddArgument("disable-dev-shm-usage");

                options.AddAdditionalCapability("username", WebDriverManager.SeleniumGridConfiguration.Username, true);
                options.AddAdditionalCapability("accessKey", WebDriverManager.SeleniumGridConfiguration.AccessKey, true);

                //TODO: Config value
                var driver = new RemoteWebDriver(new Uri(WebDriverManager.SeleniumGridConfiguration.Url), options.ToCapabilities(), TimeSpan.FromSeconds(180));
                //do not change this, the site is a bloody nightmare with overlaying buttons etc.
                driver.Manage().Window.Size = WebDriverManager.DefaultSize;
                var allowsDetection = driver as IAllowsFileDetection;
                if (allowsDetection != null)
                {
                    allowsDetection.FileDetector = new LocalFileDetector();
                }
                return(driver);
            };
        }
示例#16
0
文件: Hooks.cs 项目: drsslv/Molder
 public static void InitializeConfiguration()
 {
     BinDirectory.Create();
     ConfigurationExtension.Instance.Configuration = ConfigurationExtension.Instance.Configuration ?? ConfigurationFactory.Create(BinDirectory);
 }
示例#17
0
 static InitialDataTests()
 {
     using (Configuration configuration = new Configuration(new Context(ConfigurationFactory.Create()), new Context(ConfigurationFactory.Create())))
         configuration.UpdateDatabase();
 }