Ejemplo n.º 1
0
        public void TestPropertiesAfterCreateSaveUpdateAndRefresh()
        {
            //0. Create and save the Object
            T entity = EntityRepository <T> .AddNew();

            With.Transaction(delegate
            {
                EntityRepository <T> .Save(entity);
            }
                             );

            EntityRepository <T> .Refresh(entity);

            MakeEntityDirty(entity);

            With.Transaction(delegate
            {
                EntityRepository <T> .Save(entity);
            }
                             );

            EntityRepository <T> .Refresh(entity);

            Assert.AreEqual(entity.Version, 2);
            Assert.IsFalse(entity.IsDeleted);

            /*
             *  Assert.IsNotNull(entity.ModifiedBy);
             *  Assert.IsNotNull(entity.ModifiedOn);
             */
        }
Ejemplo n.º 2
0
        protected static T CreateAndSave()
        {
            T entity = EntityRepository <T> .AddNew();

            SaveItem(entity);

            return(entity);
        }
Ejemplo n.º 3
0
        public void TestUnDeleteNonDeletedCandidate()
        {
            TestCandidate candidate = EntityRepository <TestCandidate> .AddNew();

            candidate.Name = "Mohan";

            Save(candidate);

            With.Transaction(delegate
            {
                EntityRepository <TestCandidate> .UnDelete(candidate);
            });
        }
Ejemplo n.º 4
0
        public virtual T Create()
        {
            try
            {
                Authorize(Can_Create);
                return(EntityRepository <T> .AddNew());
            }
            catch (System.Exception ex)
            {
                bool reThrow = ExceptionHandler.HandleBusinessLogicLayerException(ex);

                if (reThrow)
                {
                    throw;
                }

                return(null);
            }
        }