public void CommitTransaction_TransactionNotStarted_InvalidOperationException()
        {
            var entityToAdd = new PGPEntity();
            m_target.RegisterNew(entityToAdd);
            m_target.CommitTransaction();

            Assert.Fail();
        }
        public void CommitTransaction_ValidTransaction_Success()
        {
            m_target.BeginTransaction();
            var entityToAdd = new PGPEntity();
            m_target.RegisterNew(entityToAdd);
            m_target.CommitTransaction();

            var entityFoundById = m_target.GetById<PGPEntity>(entityToAdd.Id);

            Assert.IsNotNull(entityFoundById);
        }
        public void RoolbackTransaction_TransactionStarted_Success()
        {
            m_target.BeginTransaction();
            var entityToAdd = new PGPEntity();
            m_target.RegisterNew(entityToAdd);
            m_target.RoolbackTransaction();

            var entityFoundById = m_target.GetById<PGPEntity>(entityToAdd.Id);

            Assert.IsNull(entityFoundById);
        }
 public void RegisterDeleted_EntityBase_Success()
 {
     var entity = new PGPEntity();
     m_target.Attach(entity);
     m_target.RegisterDeleted(entity);
 }
 public void RegisterChanged_EntityBase_Success()
 {
     var entity = new PGPEntity();
     m_target.Attach(entity);
     entity.Id = 5;
     m_target.RegisterChanged(entity);
 }
        public void GetById_ValidId_BaseEntity()
        {
            var initialList = m_target.CreateQuery<PGPEntity>().ToList();

            var entityToAdd = new PGPEntity();
            m_target.RegisterNew(entityToAdd);
            m_target.SaveContextChanges();

            var entityFoundById = m_target.GetById<PGPEntity>(entityToAdd.Id);

            Assert.IsNotNull(entityFoundById);
            Assert.AreEqual(entityFoundById.Id, entityToAdd.Id);
        }
        public void CreateQuery_UnexistingQuery_None()
        {
            var initialList = m_target.CreateQuery<PGPEntity>().ToList();

            var entityToAdd = new PGPEntity();
            m_target.RegisterNew(entityToAdd);
            m_target.SaveContextChanges();

            var finalList = m_target.CreateQuery<PGPEntity>()
                .Where(x => x.Id == -1).ToList();

            Assert.AreEqual(initialList.Count, finalList.Count);
        }
        public void CreateQuery_Default_Entities()
        {
            var initialList = m_target.CreateQuery<PGPEntity>().ToList();

            var entityToAdd = new PGPEntity();
            m_target.RegisterNew(entityToAdd);
            m_target.SaveContextChanges();

            var finalList = m_target.CreateQuery<PGPEntity>().ToList();

            Assert.AreEqual(initialList.Count + 1, finalList.Count);
            Assert.IsTrue(finalList.Any(x => x.Id == entityToAdd.Id));
        }