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); }
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(); }
// Constructors internal TransactionScope(TransactionScopeProvider transactionScopeProvider) { #region Contracts if (transactionScopeProvider == null) { throw new ArgumentNullException(); } #endregion // Default _transactionScopeProvider = transactionScopeProvider; }
// 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; } }