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 override void DbInit() { using (var scope = new NHibernateTestScope()) { var mandant = DbHandlerUtils.CreateMandant(scope.Session, TestMandantName, "0", Erfassungmodus); closedErfassungPeriod = DbHandlerUtils.CreateErfassungsPeriod(scope.Session, mandant, Erfassungmodus); closedErfassungPeriod.IsClosed = true; closedErfassungPeriod.Erfassungsjahr = new DateTime(2010, 1, 1); DbHandlerUtils.CreateMandant(scope.Session, OtherTestMandantName, "0", Erfassungmodus); DbHandlerUtils.CreateTestUser(scope.Session, TestUserName, new[] { mandant }, new List <Rolle> { Rolle.DataManager, Rolle.DataReader, Rolle.Benutzeradministrator, Rolle.Benchmarkteilnehmer }); } using (var scope = new NHibernateTestScope()) { currentErfassungsPeriod = scope.Session.Query <ErfassungsPeriod>().Single(m => !m.IsClosed && m.Mandant.MandantName == TestMandantName); currentErfassungsPeriod.Erfassungsjahr = new DateTime(2012, 1, 1); otherErfassungPeriod = scope.Session.Query <ErfassungsPeriod>().Single(m => !m.IsClosed && m.Mandant.MandantName == OtherTestMandantName); otherErfassungPeriod.Erfassungsjahr = new DateTime(2012, 1, 1); } Init(); }
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(); }
public void GegebenSeiFolgendeEinstellungenExistieren(Table table) { var reader = GetObjectReaderConfigurationFor <MandantDetails>() .ConverterFor(e => e.Mandant, (s, p) => new Mandant() { MandantName = s }) .ConverterFor(e => e.Gemeindetyp, (s, p) => ScenarioContextWrapper.CurrentScope.Session.Query <GemeindeKatalog>().ToArray().Single(i => i.Typ == s)) .ConverterFor(e => e.OeffentlicheVerkehrsmittel, (s, p) => ScenarioContextWrapper.CurrentScope.Session.Query <OeffentlicheVerkehrsmittelKatalog>().Single(i => i.Typ == s)) .GetObjectReader(); using (var nhScope = new NHibernateSpecflowScope()) { foreach (var row in reader.GetObjectListWithRow <MandantDetails>(table)) { row.Item2.IsCompleted = true; DbHandlerUtils.CreateMandant(nhScope.Session, row.Item1["Mandant"], null, mandantDetails: row.Item2); } } using (var nhScope = new NHibernateSpecflowScope()) { IQueryable <Mandant> mandanten = nhScope.Session.Query <Mandant>(); DbHandlerUtils.CreateTestUser(nhScope.Session, DbHandlerUtils.IntegrationTestUserName, mandanten, new List <Rolle>() { Rolle.Benutzeradministrator, Rolle.DataManager, Rolle.Benchmarkteilnehmer }); } }
private void SetupTestUserRole(Rolle rolle) { using (var scope = new NHibernateSpecflowScope()) { DbHandlerUtils.SetupTestUserRole(scope.Session, DbHandlerUtils.IntegrationTestUserName, rolle); } }
protected override void DbInit() { ClosedErfassungPeriods = new Dictionary <NetzErfassungsmodus, ErfassungsPeriod>(); CurrentErfassungPeriods = new Dictionary <NetzErfassungsmodus, ErfassungsPeriod>(); using (var scope = new NHibernateTestScope()) { foreach (NetzErfassungsmodus modus in Enum.GetValues(typeof(NetzErfassungsmodus))) { var mandantName = modus.ToString() + "Mandant"; var mandant = DbHandlerUtils.CreateMandant(scope.Session, mandantName, "0", modus); mandants[modus] = mandant; ClosedErfassungPeriods[modus] = DbHandlerUtils.CreateErfassungsPeriod(scope.Session, mandant, modus); ClosedErfassungPeriods[modus].IsClosed = true; ClosedErfassungPeriods[modus].Erfassungsjahr = new DateTime(2010, 1, 1); } DbHandlerUtils.CreateTestUser(scope.Session, TestUserName, mandants.Values, DbHandlerUtils.AllRollen); } PrepareData(); }
private void CreateTestUserWithRoles(string mandantName, List <Rolle> rollen) { using (var nhScope = new NHibernateSpecflowScope()) { IQueryable <Mandant> mandanten = nhScope.Session.Query <Mandant>().Where(m => m.MandantName == mandantName); DbHandlerUtils.CreateTestUser(nhScope.Session, DbHandlerUtils.IntegrationTestUserName, mandanten, rollen); } }
protected override void DbInit() { //Setup role using (var scope = new NHibernateTestScope()) { var mandant = DbHandlerUtils.CreateMandant(scope.Session, TestMandantName, "0", NetzErfassungsmodus.Gis); DbHandlerUtils.CreateTestUser(scope.Session, TestUserName, new[] { mandant }, new List <Rolle> { Rolle.DataManager, Rolle.DataReader, Rolle.Benutzeradministrator, Rolle.Benchmarkteilnehmer }); } }
public void AngenommenFolgendeEinstellungenExistieren(Table table) { var einstellungenRows = table.CreateSet <EinstellungenRow>(); using (var nhScope = new NHibernateSpecflowScope()) { foreach (var einstellungenRow in einstellungenRows) { DbHandlerUtils.CreateMandant(nhScope.Session, einstellungenRow.Mandant, null, GetModus(einstellungenRow.Modus)); } } }
private void InsertTestData() { ErfassungsPeriod oldErfassungPeriod; using (var scope = new NHibernateTestScope()) { var current = scope.Session.Get <ErfassungsPeriod>(GetClosedErfassungPeriod(scope).Id); oldErfassungPeriod = DbHandlerUtils.CreateErfassungsPeriod(scope.Session, current.Mandant, Erfassungmodus); oldErfassungPeriod.IsClosed = true; oldErfassungPeriod.Erfassungsjahr = new DateTime(2009, 1, 1); } using (var scope = new NHibernateTestScope()) { var entiyOne = TestDataHelpers.GetRealisierteMassnahmeGIS(GetCurrentErfassungsPeriod(scope), "RMG01", "ORG1", "BeschreibungGIS1"); scope.Session.Save(entiyOne); var entiyTwo = TestDataHelpers.GetRealisierteMassnahmeGIS(GetCurrentErfassungsPeriod(scope), "RMG02", "ORG2", "BeschreibungGIS2"); scope.Session.Save(entiyTwo); var entiyThree = TestDataHelpers.GetRealisierteMassnahmeGIS(GetClosedErfassungPeriod(scope), "RMG03", "ORG3", "BeschreibungGIS3"); scope.Session.Save(entiyThree); var entityOtherMandant = TestDataHelpers.GetRealisierteMassnahmeGIS(GetOtherErfassungPeriod(scope), "RMGO01", "ORG1", "BeschreibungGIS4"); scope.Session.Save(entityOtherMandant); var oldEntity = TestDataHelpers.GetRealisierteMassnahmeGIS(oldErfassungPeriod, "RMG01", "ORG1", "BeschreibungGIS5"); scope.Session.Save(oldEntity); } using (var scope = new NHibernateTestScope()) { var entiyOne = TestDataHelpers.GetRealisierteMassnahmeSummarisch(GetCurrentErfassungsPeriod(scope), "RMS01", "BeschreibungSum1"); scope.Session.Save(entiyOne); var entiyTwo = TestDataHelpers.GetRealisierteMassnahmeSummarisch(GetCurrentErfassungsPeriod(scope), "RMS02", "BeschreibungSum2"); scope.Session.Save(entiyTwo); var entiyThree = TestDataHelpers.GetRealisierteMassnahmeSummarisch(GetClosedErfassungPeriod(scope), "RMS03", "BeschreibungSum3"); scope.Session.Save(entiyThree); var entityOtherMandant = TestDataHelpers.GetRealisierteMassnahmeSummarisch(GetOtherErfassungPeriod(scope), "RMSO01", "BeschreibungSum4"); scope.Session.Save(entityOtherMandant); var oldEntity = TestDataHelpers.GetRealisierteMassnahmeSummarisch(GetOtherErfassungPeriod(scope), "RMS01", "BeschreibungSum5"); scope.Session.Save(oldEntity); } using (var scope = new NHibernateTestScope()) { var entiyOne = TestDataHelpers.GetRealisierteMassnahme(GetCurrentErfassungsPeriod(scope), "RMT01", "BeschreibungTab1"); scope.Session.Save(entiyOne); var entiyTwo = TestDataHelpers.GetRealisierteMassnahme(GetCurrentErfassungsPeriod(scope), "RMT02", "BeschreibungTab2"); scope.Session.Save(entiyTwo); var entiyThree = TestDataHelpers.GetRealisierteMassnahme(GetClosedErfassungPeriod(scope), "RMT03", "BeschreibungTab3"); scope.Session.Save(entiyThree); var entityOtherMandant = TestDataHelpers.GetRealisierteMassnahme(GetOtherErfassungPeriod(scope), "RMTO01", "BeschreibungTab4"); scope.Session.Save(entityOtherMandant); var oldEntity = TestDataHelpers.GetRealisierteMassnahme(GetOtherErfassungPeriod(scope), "RMT01", "BeschreibungTab5"); scope.Session.Save(oldEntity); } }