public void MainBuildingActivity()
        {
            int count = uow.MainBuildingActivities.GetAll().AsQueryable<MainBuildingActivity>().Count<MainBuildingActivity>();

            #region Add

            MainBuildingActivity newEntity = new MainBuildingActivity()
            {
                MainBuildingActivityName = "MainBuildingActivityName"
            };
            uow.MainBuildingActivities.Add<MainBuildingActivity, int>(newEntity);
            uow.MainBuildingActivities.Commit();
            var result = uow.MainBuildingActivities.GetAll().AsQueryable<MainBuildingActivity>();
            Assert.AreEqual(count + 1, result.Count<MainBuildingActivity>(), "Adding Error");

            #endregion

            #region Update

            MainBuildingActivity entity = uow.MainBuildingActivities.GetById(newEntity.ID);
            entity.MainBuildingActivityName = "MainBuildingActivityName2";
            uow.MainBuildingActivities.Update(entity);
            uow.MainBuildingActivities.Commit();
            MainBuildingActivity entity2 = uow.MainBuildingActivities.GetById(newEntity.ID);
            Assert.AreEqual("MainBuildingActivityName2", entity2.MainBuildingActivityName, "Updating Error");

            #endregion

            #region Delete

            MainBuildingActivity entityDeleted = uow.MainBuildingActivities.GetById(newEntity.ID);
            uow.MainBuildingActivities.Delete(entity2);
            uow.MainBuildingActivities.Commit();
            Assert.AreEqual(count, uow.MainBuildingActivities.GetAll().AsQueryable<MainBuildingActivity>().Count<MainBuildingActivity>(), "Deleting Error");

            #endregion
        }
Example #2
0
 static int MainBuildingActivity()
 {
     MainBuildingActivity e = new MainBuildingActivity()
     {
         MainBuildingActivityName = "MainBuildingActivityName"
     };
     technicalLicensesUow.MainBuildingActivities.Add<MainBuildingActivity, int>(e);
     technicalLicensesUow.MainBuildingActivities.Commit();
     return e.ID;
 }