Пример #1
0
        public void IsDeleting()
        {
            var obj = Test.Create();

            obj.Update("Test_Is_Write", 11000011);

            var objId = obj.Id;

            var writeRepo = new ReadWriteRepository(GetDbContext());

            writeRepo.Create <Test, Guid>(obj);

            //THIS IS NOT DONE IN PRODUCTION
            writeRepo.Commit();

            var readRepo = new ReadOnlyRepository(GetDbContext());

            var testObj = readRepo.GetById <Test, Guid>(objId);

            Assert.AreEqual(obj.Name, testObj.Name);
            Assert.AreEqual(obj.Value, testObj.Value);

            writeRepo.Delete <Test, Guid>(obj);

            writeRepo.Commit();

            var table = readRepo.Table <Test, Guid>().Where(o => o.Id.Equals(obj.Id)).ToList();

            Assert.AreEqual(table.Count, 0);
        }
Пример #2
0
        public void IsReading()
        {
            var readRepo = new ReadOnlyRepository(GetDbContext());

            var testObj = readRepo.Table <Test, Guid>().First();

            Assert.IsNotNull(testObj.Name);
            Assert.IsNotNull(testObj.Value);

            Assert.GreaterOrEqual(testObj.Value, 100);
        }