public void CreateSettings_WithValidConfiguration_ReturnSettings()
        {
            // Act
            var settings = new Settings()
            {
                Browser = BrowserType.CHROME,
                Options = new List <string>()
                {
                    "--start-maximized", "--ignore-certificate-errors", "--disable-cache"
                },
                Timeout        = 60,
                BinaryLocation = "C:\abc\abc\abc.exe",
                Capabilities   = new Dictionary <string, string>()
                {
                    { "a", "1" },
                    { "a1", "11" }
                },
                IsRemote = true,
                Remote   = new Remote()
                {
                    Platform = "win",
                    Project  = "Molder",
                    Url      = "url.ru",
                    Version  = "67.0"
                }
            };
            // Arrange
            var optionSettings = ConfigOptionsFactory.Create(_configurationBuilder);

            // Assert
            optionSettings.Value.Should().BeEquivalentTo(settings);
        }
예제 #2
0
        public static void InitializeConfiguration()
        {
            var settings = ConfigOptionsFactory.Create(ConfigurationExtension.Instance.Configuration);

            LoggerSettings.Settings = settings.Value;

            Molder.Helpers.Log.LoggerFactory.ConfigureLogger();
        }
예제 #3
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);
        }
예제 #4
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);
        }
        public Hooks(VariableController variableController,
                     FeatureContext featureContext, ScenarioContext scenarioContext)
        {
            this.variableController = variableController;
            this.featureContext     = featureContext;
            this.scenarioContext    = scenarioContext;

            BinDirectory.Create();
            var configuration = ConfigurationFactory.Create(BinDirectory);

            config.Value = ConfigOptionsFactory.Create(configuration);
        }
예제 #6
0
        public void CreateConfiguration_EmptyTag_ReturnEmptyList()
        {
            string json = "{" + $"\"{Constants.CONFIG_BLOCK}\"" + ": {}}";

            var testConfiguration = new ConfigurationBuilder()
                                    .AddJsonStream(json.ToStream())
                                    .Build();

            var configConfiguration = ConfigOptionsFactory.Create(testConfiguration);

            configConfiguration.Value.Count().Should().Be(0);
        }
예제 #7
0
        public void CreateConfiguration_EmptyConfigBlock_ReturnEmptyList()
        {
            string json = "{\"AnotherSegment\": {}}";

            var testConfiguration = new ConfigurationBuilder()
                                    .AddJsonStream(json.ToStream())
                                    .Build();

            var configConfiguration = ConfigOptionsFactory.Create(testConfiguration);

            configConfiguration.Value.Count().Should().Be(0);
        }
        public void CreateSettings_WithIncorrectConfiguration_ReturnNull()
        {
            var configurationDictionary = new Dictionary <string, string>
            {
                { "Molder:Browser", "Chrome" }
            };
            var configurationBuilder = new ConfigurationBuilder()
                                       .AddInMemoryCollection(configurationDictionary)
                                       .Build();

            var optionSettings = ConfigOptionsFactory.Create(configurationBuilder);

            optionSettings.Value.Should().BeNull();
        }
예제 #9
0
        public static void InitializeConfiguration()
        {
            var settings = ConfigOptionsFactory.Create(ConfigurationExtension.Instance.Configuration);

            if (settings.Value is null)
            {
                Log.Logger().LogInformation($@"appsettings is not contains {Constants.CONFIG_BLOCK} block. Standard settings selected.");
                BrowserSettings.Settings = new Settings();
            }
            else
            {
                Log.Logger().LogInformation($@"appsettings contains {Constants.CONFIG_BLOCK} block. Settings selected.");
                BrowserSettings.Settings = settings.Value;
            }
        }
예제 #10
0
        public void CreateConfiguration_ValidJson_ReturnOptionModel(string json, IEnumerable <ConfigFile> config)
        {
            var testConfiguration = new ConfigurationBuilder()
                                    .AddJsonStream(json.ToStream())
                                    .Build();

            var configConfiguration = ConfigOptionsFactory.Create(testConfiguration);

            configConfiguration.Value.Count().Should().Be(config.Count());

            for (var i = 0; i < configConfiguration.Value.Count(); i++)
            {
                configConfiguration.Value.ToList()[i].Should().BeEquivalentTo(config.ToList()[i]);
            }
        }
예제 #11
0
        public static void InitializeConfiguration()
        {
            var settings = ConfigOptionsFactory.Create(ConfigurationExtension.Instance.Configuration);

            if (settings.Value is null)
            {
                Log.Logger().LogInformation($@"appsettings is not contains {Constants.CONFIG_BLOCK} block. Standard settings selected.");
            }
            else
            {
                foreach (var setting in settings.Value)
                {
                    KafkaSettings.Settings.Add(setting.Name, setting);
                }

                Log.Logger().LogInformation($@"appsettings contains {Constants.CONFIG_BLOCK} block. Settings selected.");
            }
        }