public void Create() { try { rt.srz.model.srz.Content entity = CreateNew(); object result = manager.Save(entity); Assert.IsNotNull(result); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Read() { try { rt.srz.model.srz.Content entityA = CreateNew(); manager.Save(entityA); rt.srz.model.srz.Content entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA, entityB); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Delete() { try { rt.srz.model.srz.Content entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.srz.model.srz.Content entity = GetFirstContent(); manager.Delete(entity); entity = manager.GetById(entity.Id); Assert.IsNull(entity); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public static Content CreateNew(int depth = 0) { rt.srz.model.srz.Content entity = new rt.srz.model.srz.Content(); // You may need to maually enter this key if there is a constraint violation. entity.Id = System.Guid.NewGuid(); entity.DocumentContent = new System.Byte[] {}; entity.ChangeDate = System.DateTime.Now; entity.FileName = "Test Test Test Test Test Test Test Test Test Te"; entity.DocumentContent64 = "Test T"; using (rt.srz.business.manager.IConceptManager conceptManager = ObjectFactory.GetInstance <IConceptManager>()) { var all = conceptManager.GetAll(1); Concept entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = ConceptTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.ContentType = entityRef; } using (rt.srz.business.manager.IInsuredPersonDatumManager insuredPersonDatumManager = ObjectFactory.GetInstance <IInsuredPersonDatumManager>()) { entity.InsuredPersonData = null; } return(entity); }
public void Update() { try { rt.srz.model.srz.Content entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.srz.model.srz.Content entityA = GetFirstContent(); entityA.DocumentContent = new System.Byte[] {}; manager.Update(entityA); rt.srz.model.srz.Content entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA.DocumentContent, entityB.DocumentContent); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }