Example #1
0
        public void TestDelete2()
        {
            var n = SoftDelete.GetCount(Condition.Empty);

            var o = new SoftDelete {
                Name = "aaa"
            };

            o.Name = "bbb";
            o.Save();

            var o2 = new SoftDelete {
                Name = "ccc"
            };

            o2.Save();

            var m = SoftDelete.GetCount(Condition.Empty);

            Assert.AreEqual(2, m - n);

            o2.Delete();

            m = SoftDelete.GetCount(Condition.Empty);

            Assert.AreEqual(1, m - n);
        }
Example #2
0
        public void TestRead1()
        {
            SoftDelete o = SoftDelete.FindById(1);

            Assert.AreEqual("tom", o.Name);
            o = SoftDelete.FindById(4);
            Assert.IsNull(o);
        }
Example #3
0
        public void TestRead()
        {
            List <SoftDelete> ls = SoftDelete.Find(Condition.Empty, new OrderBy("Id"));

            Assert.AreEqual(3, ls.Count);
            Assert.AreEqual("tom", ls[0].Name);
            Assert.AreEqual("jerry", ls[1].Name);
            Assert.AreEqual("mike", ls[2].Name);
        }
Example #4
0
        public void TestUpdate()
        {
            SoftDelete o = SoftDelete.FindById(1);

            Assert.AreEqual("tom", o.Name);

            o.Name = "oh";
            o.Save();

            o = SoftDelete.FindById(1);
            Assert.AreEqual("oh", o.Name);
        }
Example #5
0
        public void TestInsert()
        {
            var o = new SoftDelete {
                Name = "test"
            };

            o.Save();

            SoftDeleteFull o1 = SoftDeleteFull.FindById(o.Id);

            Assert.AreEqual("test", o1.Name);
            Assert.AreEqual(false, o1.IsDeleted);
        }
Example #6
0
        public void TestDeleteAll()
        {
            SoftDelete.DeleteBy(Condition.Empty);
            var o = SoftDelete.FindById(1);

            Assert.IsNull(o);

            SoftDeleteFull o1 = SoftDeleteFull.FindById(1);

            Assert.IsNotNull(o1);
            Assert.AreEqual("tom", o1.Name);
            Assert.AreEqual(true, o1.IsDeleted);
        }
Example #7
0
        public void TestDelete()
        {
            SoftDelete o = SoftDelete.FindById(1);

            o.Delete();
            o = SoftDelete.FindById(1);
            Assert.IsNull(o);

            SoftDeleteFull o1 = SoftDeleteFull.FindById(1);

            Assert.IsNotNull(o1);
            Assert.AreEqual("tom", o1.Name);
            Assert.AreEqual(true, o1.IsDeleted);
        }