Exemple #1
0
        protected virtual object CreateGlobalContainer(IConfigurationLoader configurationLoader, Assembly testAssembly)
        {
            var containerBuilder      = new ContainerBuilder(new NoInvokeDependencyProvider());
            var configurationProvider = new DefaultRuntimeConfigurationProvider(configurationLoader);

            //var globalContainer = containerBuilder.CreateGlobalContainer(
            //        testAssembly,
            //        new DefaultRuntimeConfigurationProvider(configurationLoader));
            var globalContainer = containerBuilder.ReflectionCallMethod <object>(nameof(ContainerBuilder.CreateGlobalContainer),
                                                                                 testAssembly, configurationProvider);

            return(globalContainer);
        }
        protected override IObjectContainer CreateGlobalContainer(IConfigurationLoader configurationLoader, Assembly testAssembly)
        {
            // We need to call the CreateGlobalContainer through reflection because the interface has been changed in V3.0.220.

            var containerBuilder      = new ContainerBuilder(new NoInvokeDependencyProvider());
            var configurationProvider = new DefaultRuntimeConfigurationProvider(configurationLoader);

            //var globalContainer = containerBuilder.CreateGlobalContainer(
            //        new DefaultRuntimeConfigurationProvider(configurationLoader));
            var globalContainer = containerBuilder.ReflectionCallMethod <object>(nameof(ContainerBuilder.CreateGlobalContainer), configurationProvider);

            return((IObjectContainer)globalContainer);
        }
Exemple #3
0
        protected override IBindingRegistry GetBindingRegistry(Assembly testAssembly, string configFilePath)
        {
            IConfigurationLoader configurationLoader = new SpecFlow21ConfigurationLoader(configFilePath);
            var containerBuilder      = new ContainerBuilder(new NoInvokeDependencyProvider());
            var configurationProvider = new DefaultRuntimeConfigurationProvider(configurationLoader);

            // 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.

            //var globalContainer = containerBuilder.CreateGlobalContainer(
            //        new DefaultRuntimeConfigurationProvider(configurationLoader));
            var globalContainer = containerBuilder.ReflectionCallMethod <object>(nameof(ContainerBuilder.CreateGlobalContainer), configurationProvider);

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

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

            InitializeTestRunnerManager(testAssembly, testRunnerManager);

            //return globalContainer.Resolve<IBindingRegistry>();
            return(Resolve <IBindingRegistry>(globalContainer));
        }