public static Ot CreateNew(int depth = 0) { rt.atl.model.atl.Ot entity = new rt.atl.model.atl.Ot(); entity.Caption = "Test Test Test Test"; entity.W = 6; return(entity); }
public void Create() { try { rt.atl.model.atl.Ot 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.Ot entityA = CreateNew(); manager.Save(entityA); rt.atl.model.atl.Ot entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA, entityB); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Delete() { try { rt.atl.model.atl.Ot entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.atl.model.atl.Ot entity = GetFirstOt(); 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.Ot entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.atl.model.atl.Ot entityA = GetFirstOt(); entityA.Caption = "Tes"; manager.Update(entityA); rt.atl.model.atl.Ot entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA.Caption, entityB.Caption); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }