Ejemplo n.º 1
0
        public void Add_Entity_Set_CreatedOn()
        {
            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                db.ReCreate();
                var entity = new NotLocalizedEntity {
                    Text = "Text"
                };

                db.NotLocalizedEntities.Add(entity);
                var entityLoaded = db.SaveAndLoadEntity(entity);

                Assert.IsTrue(entityLoaded.CreatedOnUtc <= DateTime.Now);
            }
        }
Ejemplo n.º 2
0
        public void Direct_Entity_Deletion_By_Manually_Setting_DeletedOn_Deleted_It()
        {
            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                db.ReCreate();
                var entity = db.Currencies.Find(1);
                entity.ArchivedOnUtc = DateTime.Now;
                db.Currencies.Remove(entity);
                db.SaveChanges();
            }

            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                var entity = db.Currencies.Find(1);

                Assert.IsNull(entity);
            }
        }
Ejemplo n.º 3
0
        public void FirstLevel_Entity_Deletion_Marks_It_As_Deleted_But_Preserve_It()
        {
            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                db.ReCreate();
                var entity = db.Currencies.First();
                db.Currencies.Remove(entity);
                db.SaveChanges();
            }

            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                var entity = db.Currencies.First();

                Assert.AreEqual(1, entity.Id);
                Assert.IsNotNull(entity.ArchivedOnUtc);
            }
        }
Ejemplo n.º 4
0
        public void SecondLevel_Entity_Deletion_Deleted_It()
        {
            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                db.ReCreate();
                var entity = db.Currencies.Find(1);
                db.Currencies.Remove(entity);
                db.SaveChanges();
            }

            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                var entity = db.Currencies.Find(1);
                db.Currencies.Remove(entity);
                db.SaveChanges();
            }

            using (var db = new EntityLocalizationTests.TestDataContext())
            {
                var entity = db.Currencies.Find(1);

                Assert.IsNull(entity);
            }
        }