public static Okato CreateNew(int depth = 0) { rt.atl.model.atl.Okato entity = new rt.atl.model.atl.Okato(); entity.Dedit = System.DateTime.Now; entity.Caption = "Test Test "; entity.Code = "123"; entity.Parentid = 54; entity.Centrum = "Test Test Test Test Test Test Test Test Test Test Test Test Test T"; return(entity); }
public void Create() { try { rt.atl.model.atl.Okato entity = CreateNew(); object result = manager.Save(entity); Assert.IsNotNull(result); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Read() { try { rt.atl.model.atl.Okato entityA = CreateNew(); manager.Save(entityA); rt.atl.model.atl.Okato entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA, entityB); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Delete() { try { rt.atl.model.atl.Okato entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.atl.model.atl.Okato entity = GetFirstOkato(); manager.Delete(entity); entity = manager.GetById(entity.Id); Assert.IsNull(entity); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Update() { try { rt.atl.model.atl.Okato entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.atl.model.atl.Okato entityA = GetFirstOkato(); entityA.Dedit = System.DateTime.Now; manager.Update(entityA); rt.atl.model.atl.Okato entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA.Dedit, entityB.Dedit); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }