Example #1
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Re‌​ferenceLoopHandling = ReferenceLoopHandling.Ignore;
            //HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
            AreaRegistration.RegisterAllAreas();
            // from MVC 4 template
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            //AuthConfig.RegisterAuth();

            ModelBinders.Binders.Add(typeof(List <Domain.WorkerRequest>), new workerRequestBinder());
            var initializer = new MacheteInitializer();

            Database.SetInitializer(initializer);
            IUnityContainer container = UnityConfig.GetUnityContainer();
            var             db        = container.Resolve <IDatabaseFactory>();

            initializer.InitializeDatabase(db.Get());
            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
            GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container);
            GlobalConfiguration.Configuration.EnsureInitialized();
            var workerService = container.Resolve <IWorkerService>();

            workerService.ExpireMembers();
            workerService.ReactivateMembers();
        }
Example #2
0
        public IPage GoTo <T>() where T : IPage
        {
            if (this is T /*&& this.IsAt()*/)
            {
                return(this);
            }
            var page = UnityConfig.GetUnityContainer().Resolve <T>(new ParameterOverride("fixture", _refFixture));

            _refFixture.SetPage(page);
            return(page.GoTo <T>(page.PageUrl));
        }
Example #3
0
        public IPage GoTo <T>(string url) where T : IPage
        {
            this.GoTo(url);
            if (this is T /*&& this.IsAt()*/)
            {
                return(this);
            }
            var page = UnityConfig.GetUnityContainer().Resolve <T>(new ParameterOverride("fixture", _refFixture));

            //if (page.IsAt())
            //{
            _refFixture.SetPage(page);
            return(page);
            //}
            //throw new InvalidPageException("GoTo method: can not swith to your page cause the view in broswer is not valid.");
        }
Example #4
0
 public T As <T>() where T : IPage
 {
     if (this is T page)
     {
         if (page.IsAt())
         {
             return(page);
         }
     }
     else
     {
         var nextPage = UnityConfig.GetUnityContainer().Resolve <T>(new ParameterOverride("fixture", _refFixture));
         if (nextPage.IsAt())
         {
             (_refFixture as IFixture).SetPage(nextPage);
             return(nextPage);
         }
     }
     throw new InvalidPageException("As method: can not swith to your page cause the view in broswer is not valid.");
 }
Example #5
0
        public virtual void OneTimeSetUp()
        {
            var container = UnityConfig.GetUnityContainer();

            DbConnectionManager = container.Resolve <IDbConnectionManager>();
            Setting             = container.Resolve <ISetting>();
            Logger         = container.Resolve <ILog>();
            Logger.Context = $"{TestContext.CurrentContext.Test.ClassName}";
            var factory = UnityConfig.GetUnityContainer().Resolve <IWebDriverFactory>();

            Driver            = factory.CreateWebDriver();
            FindManager       = container.Resolve <IFindManager>(new ParameterOverride("driver", Driver));
            WaitManager       = container.Resolve <IWaitManager>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("logger", Logger));
            MouseManager      = container.Resolve <IMouseManager>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("waitManager", WaitManager), new ParameterOverride("logger", Logger));
            KeyboardManager   = container.Resolve <IKeyboardManager>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("waitManager", WaitManager), new ParameterOverride("logger", Logger));
            NavigationManager = container.Resolve <INavigationManager>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("waitManager", WaitManager), new ParameterOverride("logger", Logger));
            Helper            = container.Resolve <IHelper>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("waitManager", WaitManager), new ParameterOverride("logger", Logger));
            CurrentPage       = new BlankPage(this);
            Logger.LogInfo($"################################################################################################");
            Logger.LogInfo($"OneTimeSetUp");
        }
Example #6
0
        public virtual void BeforeScenario()
        {
            var container = UnityConfig.GetUnityContainer();

            DbConnectionManager = container.Resolve <IDbConnectionManager>();
            Setting             = container.Resolve <ISetting>();
            Logger         = container.Resolve <ILog>();
            Logger.Context = $"{ScenarioContext.Current.ScenarioInfo.Title}";
            var factory = container.Resolve <IWebDriverFactory>();

            Driver            = factory.CreateWebDriver();
            FindManager       = container.Resolve <IFindManager>(new ParameterOverride("driver", Driver));
            WaitManager       = container.Resolve <IWaitManager>(new ParameterOverride("driver", Driver), new ParameterOverride("finder", FindManager), new ParameterOverride("logger", Logger));
            MouseManager      = container.Resolve <IMouseManager>(new ParameterOverride("driver", Driver), new ParameterOverride("finder", FindManager), new ParameterOverride("waiter", WaitManager), new ParameterOverride("logger", Logger));
            KeyboardManager   = container.Resolve <IKeyboardManager>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("waitManager", WaitManager), new ParameterOverride("logger", Logger));
            NavigationManager = container.Resolve <INavigationManager>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("waitManager", WaitManager), new ParameterOverride("logger", Logger));
            Helper            = container.Resolve <IHelper>(new ParameterOverride("driver", Driver), new ParameterOverride("findManager", FindManager), new ParameterOverride("waitManager", WaitManager), new ParameterOverride("logger", Logger));
            CurrentPage       = new BlankPage(this);
            Logger.LogInfo($"################################################################################################");
            Logger.LogInfo($"BeforeScenario");
        }
Example #7
0
 public FluentRecordBase()
 {
     container = UnityConfig.GetUnityContainer();
     AddDBFactory();
     ToServ <ILookupService>().populateStaticIds();
 }