Beispiel #1
0
 public void DefaultChecklistTypesExistsTest()
 {
     using (var dal = new DataAccessLayerBase<MainDbContext>())
     {
         Assert.IsTrue(dal.DbContext.ChecklistTypes.Count() > 0);
     }
 }
        public static T GetDataInterface <T>() where T : class
        {
            T theObject = PrestoServerUtility.Container.Resolve <T>();

            DataAccessLayerBase theObjectAsRavenDalBase = theObject as DataAccessLayerBase;

            // HACK: We want one session per logic call, and this is how we're doing it. Only the logic classes call this
            //       method. The data classes call each other directly (if that's even necessary, and I don't think it is).
            if (theObjectAsRavenDalBase != null)
            {
                theObjectAsRavenDalBase.SetAsInitialDalInstanceAndCreateSession();
            }

            return(theObject as T);
        }
Beispiel #3
0
        public void CreateAndDeleteUsersTest()
        {
            using (var dal = new DataAccessLayerBase<MainDbContext>())
            {
                var userCount = dal.DbContext.PromouterUsers.Count();
                var promouter = dal.Create<PromouterUser>(new PromouterUser
                {
                    Email = "*****@*****.**"
                });
                dal.DbContext.SaveChanges();

                Assert.AreEqual(userCount + 1, dal.DbContext.PromouterUsers.Count());

                dal.Delete<PromouterUser>(dal.DbContext.Entry(promouter).Entity);
                dal.DbContext.SaveChanges();

                Assert.AreEqual(userCount, dal.DbContext.PromouterUsers.Count());
            }
        }