示例#1
0
 public static NetzSummarischDetail GetNetzSummarischDetail(this NHibernateSpecflowScope scope, string belastungskategorie, Mandant mandant, ErfassungsPeriod erfassungsPeriod)
 {
     return(scope.Session.Query <NetzSummarischDetail>()
            .Single(ns => ns.Belastungskategorie.Typ == belastungskategorie &&
                    ns.NetzSummarisch.Mandant == mandant &&
                    ns.NetzSummarisch.ErfassungsPeriod == erfassungsPeriod));
 }
示例#2
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);
        }
示例#3
0
        public static Mandant GetCurrentMandant(this NHibernateSpecflowScope scope)
        {
            var dbCtx = new ApplicationDbContext(scope.Session.Connection.ConnectionString);
            var currentUserMandanten = dbCtx.MandantRoles.Where(m => m.User.UserName == "test")
                                       .Select(a => a.MandantName).Distinct().Single();

            return(scope.Session.Query <Mandant>().Single(c => c.MandantName == currentUserMandanten));
        }
示例#4
0
 public static Belastungskategorie GetBelastungskategorie(this NHibernateSpecflowScope scope, string belastungskategorieTyp)
 {
     return(scope.Session.Query <Belastungskategorie>().Single(bk => bk.Typ == belastungskategorieTyp));
 }
示例#5
0
 public static List <ErfassungsPeriod> GetClosedErfassungsperiods(this NHibernateSpecflowScope scope, string mandant)
 {
     return(scope.Session.Query <ErfassungsPeriod>().Where(ep => ep.Mandant.MandantName == mandant && ep.IsClosed).ToList());
 }
示例#6
0
 public static ErfassungsPeriod GetCurrentErfassungsperiod(this NHibernateSpecflowScope scope, Mandant mandant)
 {
     return(scope.Session.Query <ErfassungsPeriod>().Single(ep => ep.Mandant == mandant && !ep.IsClosed));
 }
示例#7
0
 public static Mandant GetMandant(this NHibernateSpecflowScope scope, string mandant)
 {
     return(scope.Session.Query <Mandant>().Single(m => m.MandantName == mandant));
 }