Exemple #1
0
        public static void InitializeTestSuite(TestContext testContext)
        {
            // register routes for UrlHelper
            GlobalAsaxFacts.RegisterAllRoutes(testContext);

            // use simple injector for dependency injection
            ServiceProviderLocator.SetProvider(new SimpleServiceProvider());

            // for the Chrome driver to start, chromedriver.exe should automatically copy from
            // the test project to /bin/Debug during build.
            // as of October 2011, please instead put chromedriver.exe directly in the C:\ drive

            // for IE driver to start, make sure "Enable Protected Mode" is checked for all zones:
            // go to Internet Options, and click the Security tab
            // ensure "Enable Protected Mode" is checked for Internet, Local intranet,
            // Trusted sites, and Restricted sites.

            // inject browser dependencies from IoC into static Browsers list property
            Browsers = new List <IWebDriver>(ServiceProviderLocator.Current.GetServices <IWebDriver>());
        }
Exemple #2
0
        private static void SetUpDependencyInjection()
        {
            var containerConfiguration = new ContainerConfiguration
            {
                IsDeployedToCloud = WebConfig.IsDeployedToCloud,
                GeoPlanetAppId    = WebConfig.GeoPlanetAppId,
                GeoNamesUserName  = WebConfig.GeoNamesUserName,
            };
            var serviceProvider = new SimpleDependencyInjector(containerConfiguration);

            ServiceProviderLocator.SetProvider(serviceProvider);

            // use infrastructure service locator for MVC dependency resolution
            DependencyResolver.SetResolver(new MvcDependencyResolver());

            var providers = FilterProviders.Providers.OfType <FilterAttributeFilterProvider>().ToList();

            providers.ForEach(provider => FilterProviders.Providers.Remove(provider));
            FilterProviders.Providers.Add(ServiceProviderLocator.Current.GetService <SimpleFilterAttributeFilterProvider>());
        }