public static Template CreateNew(int depth = 0) { rt.srz.model.srz.Template entity = new rt.srz.model.srz.Template(); // You may need to maually enter this key if there is a constraint violation. entity.Id = System.Guid.NewGuid(); entity.Name = "Test Test "; entity.PosSmo = "T"; entity.PosAddress = "Test Test Tes"; entity.PosDay1 = "Tes"; entity.PosMonth1 = "Test Test"; entity.PosYear1 = "Tes"; entity.PosBirthplace = "Te"; entity.PosMale = "Test"; entity.PosFemale = "Test Test Te"; entity.PosDay2 = "Test Test "; entity.PosMonth2 = "Test Test Test"; entity.PosYear2 = "Test T"; entity.PosFio = "Tes"; entity.PosLine1 = "Test T"; entity.PosLin2 = "Test Test Te"; entity.PosLine3 = "Test "; entity.Default = true; return(entity); }
public void Create() { try { rt.srz.model.srz.Template 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.Template entityA = CreateNew(); manager.Save(entityA); rt.srz.model.srz.Template entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA, entityB); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Delete() { try { rt.srz.model.srz.Template entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.srz.model.srz.Template entity = GetFirstTemplate(); manager.Delete(entity); entity = manager.GetById(entity.Id); Assert.IsNull(entity); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Update() { try { rt.srz.model.srz.Template entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.srz.model.srz.Template entityA = GetFirstTemplate(); entityA.Name = "Test Test "; manager.Update(entityA); rt.srz.model.srz.Template entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA.Name, entityB.Name); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }