Example #1
0
        public void Loads_input_config_for_null_config_file()
        {
            var sut = new SpecFlow21ConfigurationLoader(null);

            var config = sut.Load(_defaultConfig);

            config.Should().BeSameAs(_defaultConfig);
        }
Example #2
0
        public void Loads_default_config_for_null_config_file_and_null_input()
        {
            var sut = new SpecFlow21ConfigurationLoader(null);

            var config = sut.Load(null);

            config.Should().NotBeNull();
            config.FeatureLanguage.ToString().Should().Be("en-US");
        }
Example #3
0
        protected override IBindingRegistry GetBindingRegistry(Assembly testAssembly, string configFilePath)
        {
            IConfigurationLoader configurationLoader = new SpecFlow21ConfigurationLoader(configFilePath, true);
            var globalContainer =
                new ContainerBuilder(new NoInvokeDependencyProvider()).CreateGlobalContainer(
                    new DefaultRuntimeConfigurationProvider(configurationLoader));
            var testRunnerManager = (TestRunnerManager)globalContainer.Resolve <ITestRunnerManager>();

            testRunnerManager.Initialize(testAssembly);
            testRunnerManager.CreateTestRunner(0);

            return(globalContainer.Resolve <IBindingRegistry>());
        }
Example #4
0
        public void Loads_input_config_for_AppConfig_file_without_specflow_node()
        {
            var configFileContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
</configuration>";
            var filePath          = Path.GetTempPath() + ".config";

            File.WriteAllText(filePath, configFileContent);
            var sut = new SpecFlow21ConfigurationLoader(filePath);

            var config = sut.Load(_defaultConfig);

            config.Should().BeSameAs(_defaultConfig);
        }
Example #5
0
        protected override IBindingRegistry GetBindingRegistry(Assembly testAssembly, string configFilePath)
        {
            // We need to call the BoDi (IObjectContainer) related invocations through reflection, because
            // the real call would try to load IObjectContainer from the TechTalk.SpecFlow assembly.

            IConfigurationLoader configurationLoader = new SpecFlow21ConfigurationLoader(configFilePath);
            var globalContainer = CreateGlobalContainer(configurationLoader, testAssembly);

            ReflectionExtensions.RegisterTypeAs <NoInvokeDependencyProvider.NullBindingInvoker, IBindingInvoker>(globalContainer);

            //var testRunnerManager = (TestRunnerManager)globalContainer.Resolve<ITestRunnerManager>();
            var testRunnerManager = (TestRunnerManager)ReflectionExtensions.Resolve <ITestRunnerManager>(globalContainer);

            InitializeTestRunnerManager(testAssembly, testRunnerManager);

            //return globalContainer.Resolve<IBindingRegistry>();
            return(ReflectionExtensions.Resolve <IBindingRegistry>(globalContainer));
        }
Example #6
0
        public void Loads_config_from_JSON_SpecFlow3_Style()
        {
            var configFileContent = @"
{
    ""language"": {
        ""feature"": ""de-AT""
    }
}";
            var filePath          = Path.GetTempPath() + ".json";

            File.WriteAllText(filePath, configFileContent);
            var sut = new SpecFlow21ConfigurationLoader(filePath, true);

            var config = sut.Load(_defaultConfig);

            config.Should().NotBeNull();
            config.FeatureLanguage.ToString().Should().Be("de-AT");
        }
Example #7
0
        public void Loads_config_from_AppConfig()
        {
            var configFileContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
  <configSections>
    <section name=""specFlow"" type=""TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"" />
  </configSections>
  <specFlow>
    <language feature=""de-AT"" />
  </specFlow>
</configuration>";
            var filePath          = Path.GetTempPath() + ".config";

            File.WriteAllText(filePath, configFileContent);
            var sut = new SpecFlow21ConfigurationLoader(filePath);

            var config = sut.Load(_defaultConfig);

            config.Should().NotBeNull();
            config.FeatureLanguage.ToString().Should().Be("de-AT");
        }