Exemplo n.º 1
0
        public void RegisterDependencies(IObjectContainer objectContainer)
        {
            objectContainer.RegisterInstanceAs(new DatabaseContext());

            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile(Path.Combine(_testRunContext.TestDirectory, "appsettings.json"), optional: true, reloadOnChange: true)
                                    .Build();

            objectContainer.RegisterInstanceAs(config);
            objectContainer.RegisterTypeAs <DatabaseContext, IDatabaseContext>();
            objectContainer.RegisterTypeAs <ShoppingCartLogic, IShoppingCartLogic>();
            objectContainer.RegisterTypeAs <BookLogic, IBookLogic>();

            var configurationDriver = new ConfigurationDriver();

            switch (configurationDriver.Mode)
            {
            case "Integrated":
                objectContainer.RegisterTypeAs <IntegratedBookDetailsDriver, IBookDetailsDriver>();
                objectContainer.RegisterTypeAs <IntegratedHomeDriver, IHomeDriver>();
                objectContainer.RegisterTypeAs <IntegratedShoppingCartDriver, IShoppingCartDriver>();
                objectContainer.RegisterTypeAs <IntegratedSearchDriver, ISearchDriver>();
                objectContainer.RegisterTypeAs <IntegratedSearchResultDriver, ISearchResultDriver>();
                break;

            case "Chrome":
            case "Chrome-Headless":
            case "Edge":
            case "Firefox":
                objectContainer.RegisterTypeAs <SeleniumBookDetailsDriver, IBookDetailsDriver>();
                objectContainer.RegisterTypeAs <SeleniumHomeDriver, IHomeDriver>();
                objectContainer.RegisterTypeAs <SeleniumShoppingCartDriver, IShoppingCartDriver>();
                objectContainer.RegisterTypeAs <SeleniumSearchDriver, ISearchDriver>();
                objectContainer.RegisterTypeAs <SeleniumSearchResultDriver, ISearchResultDriver>();
                break;
            }
        }
Exemplo n.º 2
0
 public Screenshots(BrowserDriver browserDriver, ConfigurationDriver configurationDriver)
 {
     _browserDriver       = browserDriver;
     _configurationDriver = configurationDriver;
 }