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(); }
/// <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); }
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(); }
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(); }
/// <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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
/// <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(); }