コード例 #1
0
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            var factory = BrowserFactory.GetBrowserFactory(logger);
            var browser = factory.GetBrowser();

            this.objectContainer.RegisterInstanceAs(browser);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterInstanceAs <IScenarioContextHelper>(new ScenarioContextHelper());
            this.objectContainer.RegisterInstanceAs(TokenManager.Current);

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
コード例 #2
0
        /// <summary>
        /// Registers all methods used to business method.
        /// </summary>
        /// <typeparam name="TType"></typeparam>
        /// <returns></returns>
        public ActionRepositories <TContext> Register <TType>() where TType : class
        {
            var r = new ActionRepository <TType, TContext>(TypeDiscovery.Instance);

            r.Initialize(_dic);
            return(this);
        }
コード例 #3
0
		public void InitializeDriver()
		{
            this.objectContainer.RegisterTypeAs<ProxyLogger, ILogger>();
		    var logger = this.objectContainer.Resolve<ILogger>();

            var factory = BrowserFactory.GetBrowserFactory(logger);
			var browser = factory.GetBrowser();
			this.objectContainer.RegisterInstanceAs(browser);

            this.objectContainer.RegisterInstanceAs<ISettingHelper>(new WrappedSettingHelper());

			var mapper = new PageMapper();
			mapper.Initialize(browser.BasePageType);
			this.objectContainer.RegisterInstanceAs<IPageMapper>(mapper);

			this.objectContainer.RegisterInstanceAs<IScenarioContextHelper>(new ScenarioContextHelper());
			this.objectContainer.RegisterInstanceAs(TokenManager.Current);

		    var repository = new ActionRepository(this.objectContainer);
			this.objectContainer.RegisterInstanceAs<IActionRepository>(repository);
			this.objectContainer.RegisterTypeAs<ActionPipelineService, IActionPipelineService>();
            
            // Initialize the repository
            repository.Initialize();
		}
コード例 #4
0
        public void TestInitializeLoadsKnownActionsInClasses()
        {
            var container = new Mock <IObjectContainer>(MockBehavior.Strict);

            container.Setup(c => c.Resolve(It.Is <Type>(t => typeof(ILocatorAction).IsAssignableFrom(t)), null)).Returns(new Mock <ILocatorAction>().Object);
            container.Setup(c => c.Resolve(It.Is <Type>(t => typeof(IPreAction).IsAssignableFrom(t)), null)).Returns(new Mock <IPreAction>().Object);
            container.Setup(c => c.Resolve(It.Is <Type>(t => typeof(IValidationComparer).IsAssignableFrom(t)), null)).Returns(new Mock <IValidationComparer>().Object);

            var repository = new ActionRepository(container.Object);

            repository.Initialize();

            container.VerifyAll();
        }
コード例 #5
0
ファイル: WebDriverSupport.cs プロジェクト: lkoorsse/specbind
        /// <summary>
        /// Initializes the page mapper at the start of the test run.
        /// </summary>
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            var factory       = BrowserFactory.GetBrowserFactory(logger);
            var configSection = configurationHandler.Value;

            bool reusingBrowser = true;

            if (!configSection.BrowserFactory.ReuseBrowser || Browser == null || Browser.IsDisposed)
            {
                Browser        = factory.GetBrowser();
                reusingBrowser = false;
            }

            if (configSection.BrowserFactory.EnsureCleanSession)
            {
                Browser.ClearCookies();

                if (reusingBrowser)
                {
                    Browser.ClearUrl();
                }
            }

            // NOTE: Don't register the browser to dispose, since doing so breaks the reuseBrowser support.
            // We will dispose it after scenario or test run as appropriate.
            this.objectContainer.RegisterInstanceAs(Browser, dispose: false);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(Browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterTypeAs <ScenarioContextHelper, IScenarioContextHelper>();
            this.objectContainer.RegisterTypeAs <TokenManager, ITokenManager>();

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
コード例 #6
0
ファイル: WebDriverSupport.cs プロジェクト: Valtech-NAS/Beta
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            IBrowser browser;

            if (this.reuseBrowser)
            {
                if (!TestRunContext.Current.TryGetValue(out browser))
                {
                    var factory = BrowserFactory.GetBrowserFactory(logger);
                    browser = new ReusableBrowser(factory.GetBrowser());
                    TestRunContext.Current.Set(browser);
                }
            }
            else
            {
                var factory = BrowserFactory.GetBrowserFactory(logger);
                browser = factory.GetBrowser();
            }
            this.objectContainer.RegisterInstanceAs(browser);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterInstanceAs <IScenarioContextHelper>(new ScenarioContextHelper());
            this.objectContainer.RegisterInstanceAs(TokenManager.Current);

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
コード例 #7
0
ファイル: WebDriverSupport.cs プロジェクト: mattq314/specbind
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            var factory       = BrowserFactory.GetBrowserFactory(logger);
            var configSection = configurationHandler.Value;

            if (!configSection.BrowserFactory.ReuseBrowser || browser == null)
            {
                browser = factory.GetBrowser();
            }

            if (configSection.BrowserFactory.EnsureCleanSession)
            {
                browser.ClearCookies();
            }

            this.objectContainer.RegisterInstanceAs(browser, dispose: true);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterTypeAs <ScenarioContextHelper, IScenarioContextHelper>();
            this.objectContainer.RegisterTypeAs <TokenManager, ITokenManager>();

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
コード例 #8
0
        public void BeforeScenario()
        {
            this.objectContainer.RegisterTypeAs <SpecFlowLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            var settings = Settings.FromConfiguration();

            this.objectContainer.RegisterInstanceAs <ISettings>(settings);

            ApplicationFactory applicationFactory
                = ApplicationFactory.Get(logger, settings.ProviderType);

            this.objectContainer.RegisterInstanceAs(applicationFactory);

            var applicationMapper = new ApplicationMapper();

            applicationMapper.Initialize(applicationFactory.BaseType);
            this.objectContainer.RegisterInstanceAs <IApplicationMapper>(applicationMapper);

            var windowMapper = new WindowMapper();

            windowMapper.Initialize(applicationFactory.BaseWindowType);
            this.objectContainer.RegisterInstanceAs <IWindowMapper>(windowMapper);

            this.objectContainer.RegisterTypeAs <Context.Context, IContext>();
            this.objectContainer.RegisterTypeAs <TokenManager, ITokenManager>();

            var repository = new ActionRepository(this.objectContainer, settings);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);

            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
コード例 #9
0
ファイル: WebDriverSupport.cs プロジェクト: lopezn/specbind
		public void InitializeDriver()
		{
			this.objectContainer.RegisterTypeAs<ProxyLogger, ILogger>();
			var logger = this.objectContainer.Resolve<ILogger>();

			var factory = BrowserFactory.GetBrowserFactory(logger);
			var configSection = configurationHandler.Value;

			if (!configSection.BrowserFactory.ReuseBrowser || browser == null) 
			{ 
				browser = factory.GetBrowser();
			}

			if (configSection.BrowserFactory.EnsureCleanSession)
			{
				browser.ClearCookies();
			}

			this.objectContainer.RegisterInstanceAs(browser);

			this.objectContainer.RegisterInstanceAs<ISettingHelper>(new WrappedSettingHelper());

			var mapper = new PageMapper();
			mapper.Initialize(browser.BasePageType);
			this.objectContainer.RegisterInstanceAs<IPageMapper>(mapper);

			this.objectContainer.RegisterInstanceAs<IScenarioContextHelper>(new ScenarioContextHelper());
			this.objectContainer.RegisterInstanceAs(TokenManager.Current);

			var repository = new ActionRepository(this.objectContainer);
			this.objectContainer.RegisterInstanceAs<IActionRepository>(repository);
			this.objectContainer.RegisterTypeAs<ActionPipelineService, IActionPipelineService>();
			
			// Initialize the repository
			repository.Initialize();
		}
コード例 #10
0
        public void TestInitializeLoadsKnownActionsInClasses()
        {
            var container = new Mock<IObjectContainer>(MockBehavior.Strict);
            container.Setup(c => c.Resolve(It.Is<Type>(t => typeof(ILocatorAction).IsAssignableFrom(t)), null)).Returns(new Mock<ILocatorAction>().Object);
            container.Setup(c => c.Resolve(It.Is<Type>(t => typeof(IPreAction).IsAssignableFrom(t)), null)).Returns(new Mock<IPreAction>().Object);
            // No post actions to test at present.
            //container.Setup(c => c.Resolve(It.Is<Type>(t => typeof(IPostAction).IsAssignableFrom(t)), null)).Returns(new Mock<IPostAction>().Object);
            container.Setup(c => c.Resolve(It.Is<Type>(t => typeof(IValidationComparer).IsAssignableFrom(t)), null)).Returns(new Mock<IValidationComparer>().Object);

            var repository = new ActionRepository(container.Object);

            repository.Initialize();

            container.VerifyAll();
        }
コード例 #11
0
ファイル: WebDriverSupport.cs プロジェクト: NickMcG/specbind
        /// <summary>
        /// Initializes the page mapper at the start of the test run.
        /// </summary>
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs<ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve<ILogger>();

            var factory = BrowserFactory.GetBrowserFactory(logger);
            var configSection = configurationHandler.Value;

            bool reusingBrowser = true;
            if (!configSection.BrowserFactory.ReuseBrowser || Browser == null || Browser.IsDisposed)
            {
                Browser = factory.GetBrowser();
                reusingBrowser = false;
            }

            if (configSection.BrowserFactory.EnsureCleanSession)
            {
                Browser.ClearCookies();

                if (reusingBrowser)
                {
                    Browser.ClearUrl();
                }
            }

            // NOTE: Don't register the browser to dispose, since doing so breaks the reuseBrowser support.
            // We will dispose it after scenario or test run as appropriate.
            this.objectContainer.RegisterInstanceAs(Browser, dispose: false);

            this.objectContainer.RegisterInstanceAs<ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();
            mapper.Initialize(Browser.BasePageType);
            this.objectContainer.RegisterInstanceAs<IPageMapper>(mapper);

            this.objectContainer.RegisterTypeAs<ScenarioContextHelper, IScenarioContextHelper>();
            this.objectContainer.RegisterTypeAs<TokenManager, ITokenManager>();

            var repository = new ActionRepository(this.objectContainer);
            this.objectContainer.RegisterInstanceAs<IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs<ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }