private static void RegisterMainDependencies() { Release(); Container = new WindsorContainer(); Container.Kernel.Resolver.AddSubResolver(new CollectionResolver(Container.Kernel)); Container.Register(Classes.FromAssemblyContaining <IKeyword>() .BasedOn <Keyword>().WithServiceSelf().WithServiceAllInterfaces()); Container.Register(Classes.FromAssemblyContaining <IKeyword>() .BasedOn <IHaveDocumentation>().WithServiceSelf().WithServiceAllInterfaces()); Container.Register(Component.For <IDataObjectAccess>().Named("SharedObjectDataAccess").Instance(SharedObjectDataAccess.Instance.Value).LifestyleSingleton()); Container.Register(Component.For <ICodeStubResolver>().ImplementedBy <CodeStubResolver>().LifestyleSingleton()); Container.Register(Component.For <IRememberedDataResolver>().ImplementedBy <RememberedDataResolver>().LifestyleSingleton()); Container.Register(Component.For <ILazyExpressionResolver>().ImplementedBy <LazyExpressionResolver>().LifestyleSingleton()); Container.Register(Component.For <IDictionaryToObjectMapper>().ImplementedBy <DictionaryToProxyMapper>().LifestyleSingleton()); //Container.Register(Component.For<ITypeRegistry>().ImplementedBy<Language>().LifestyleSingleton()); Container.Register(Component.For <IDataContext>().ImplementedBy <DataContext>().LifestyleSingleton()); _seleniumAdapterInstance = new SeleniumAdapter(); Container.Register(Component.For <ISeleniumAdapter>().Instance(_seleniumAdapterInstance)); Container.Register(Component.For <IDatabaseAdapter>().ImplementedBy <DatabaseAdapter>().LifestyleSingleton()); Container.Register(Component.For <ILanguage, ITypeRegistry>().ImplementedBy <Language>().LifestyleSingleton()); Container.Register(Component.For <IOverlay>().ImplementedBy <Overlay>().LifestyleSingleton()); Container.Register(Component.For <ILateBoundDataContext>().ImplementedBy <LateBoundDataContext>().LifestyleSingleton()); Container.Register(Component.For <IInterpreter>().ImplementedBy <Interpreter>().LifestyleSingleton()); Container.Register(Component.For <IAnnotationOverlay>().ImplementedBy <AnnotationOverlay>().LifestyleSingleton()); Container.Register(Component.For <IBrowserOverlay>().ImplementedBy <BrowserOverlay>().LifestyleSingleton()); Container.Kernel.AddFacility <TypedFactoryFacility>(); ServiceLocator.Initialise(Container); }
public static void RegisterForRuntime(IEnumerable <IDataObjectAccess> dataSources) { _container = new WindsorContainer(); _container.Kernel.Resolver.AddSubResolver(new CollectionResolver(_container.Kernel)); _container.Register(Component.For <ITypeRegistry>().ImplementedBy <TypeRegistry>().LifestylePerThread()); var i = 0; foreach (var ds in dataSources) { _container.Register(Component.For <IDataObjectAccess>().Instance(ds).Named(ds.ToString() + i++).LifestyleSingleton()); } i = 0; foreach (var configObject in dataSources.SelectMany(ds => ds.GetAll <IConfig>())) { _container.Register(Component.For(configObject.GetType()).Instance(configObject).Named(configObject.ToString() + i++).LifestyleTransient()); } var path = FileFinder.Find("chromedriver.exe"); var selenium = new ChromeDriver(Path.GetDirectoryName(path), new ChromeOptions()); _seleniumAdapter = new SeleniumAdapter(selenium); _container.Register(Component.For <ISeleniumAdapter>().Instance(_seleniumAdapter)); _container.Register(Component.For <IConsoleDebugger>().ImplementedBy <ConsoleDebugger>().LifestyleSingleton()); _container.Register(Component.For <IDataContext>().ImplementedBy <DataContext>().LifestyleSingleton()); _container.Register(Component.For <IOverlay>().ImplementedBy <Overlay>().LifestyleSingleton()); //_container.Resolve<IOverlay>().Graphics.Clear(Color.FromArgb(0,0,0,0)); //_container.Resolve<IOverlay>().Graphics.FillRectangle(new SolidBrush(Color.FromArgb(24, 255, 0, 0)), 100,100,200,200); ServiceLocator.Initialise(_container); }
//[SetUp] public void SetUp() { _selenium = new SeleniumAdapter(); }
//[SetUp] public void SetUp() { _selenium = new SeleniumAdapter(new ChromeDriver(Path.GetDirectoryName(FileFinder.Find("chromedriver.exe")), new ChromeOptions())); }