Esempio n. 1
0
        public void BeforeScenario()
        {
            if (ScenarioContext.Current.ScenarioInfo.Tags.Contains("Manuell"))
            {
                return;
            }

            //Initialize Db
            if (File.Exists("emsg.sdf"))
            {
                File.Delete("emsg.sdf");
            }

            var dbHandlerUtils = new DbHandlerUtils(NHibernateDb.ConfigurationProvider.Value.Configuration);

            dbHandlerUtils.ReCreateDbSchema();

            using (var nHScope = new NHibernateSpecflowScope())
            {
                dbHandlerUtils.GenerateStammDaten(nHScope.Session);
                var transactionScopeProvider = new TransactionScopeProvider(new TestHttpRequestService(), new TransactionScopeFactory(NHibernateDb.ConfigurationProvider.Value));
                transactionScopeProvider.SetCurrentTransactionScope(nHScope.Scope);
            }

            var browserDriver = new BrowserDriver();

            browserDriver.InvokeGetAction <TestingController, ActionResult>((c, r) => c.StartNewSession(), (ActionResult)null);
        }
Esempio n. 2
0
        protected void Initialize()
        {
            var appHost = AppHostBuilder.AppHost;

            //Initialize Db
            if (File.Exists("emsg.sdf"))
            {
                File.Delete("emsg.sdf");
            }

            var dbHandlerUtils = new DbHandlerUtils(NHibernateDb.ConfigurationProvider.Value.Configuration);

            dbHandlerUtils.ReCreateDbSchema();


            using (var nHScope = new NHibernateTestScope())
            {
                dbHandlerUtils.GenerateStammDaten(nHScope.Session);
                var transactionScopeProvider = new TransactionScopeProvider(new TestHttpRequestService(), new TransactionScopeFactory(NHibernateDb.ConfigurationProvider.Value));
                transactionScopeProvider.SetCurrentTransactionScope(nHScope.Scope);
            }

            BrowserDriver = new BrowserDriver();
            BrowserDriver.InvokeGetAction <TestingController, ActionResult>((c, r) => c.StartNewSession(), (ActionResult)null);

            var cultureInfo = CultureInfo.CreateSpecificCulture("de-at");

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;

            LocalizationService = new StubLocalizationService();

            DbInit();
        }
Esempio n. 3
0
        // Constructors
        internal TransactionScope(TransactionScopeProvider transactionScopeProvider)
        {
            #region Contracts

            if (transactionScopeProvider == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Default
            _transactionScopeProvider = transactionScopeProvider;
        }
Esempio n. 4
0
        // Constructors
        public LockTransactionScopeProvider(object syncRoot, TransactionScopeFactory transactionScopeFactory)
        {
            #region Contracts

            if (syncRoot == null)
            {
                throw new ArgumentNullException();
            }
            if (transactionScopeFactory == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Default
            _syncRoot = syncRoot;

            // Execute
            try
            {
                // Monitor
                Monitor.Enter(_syncRoot);

                // TransactionScopeProvider
                _transactionScopeProvider = transactionScopeFactory.Create();
                if (_transactionScopeProvider == null)
                {
                    throw new InvalidOperationException("_transactionScopeProvider=null");
                }
            }
            catch
            {
                // Dispose
                this.Dispose();

                // Throw
                throw;
            }
        }