public void Create() { try { rt.srz.model.srz.Setting 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.Setting entityA = CreateNew(); manager.Save(entityA); rt.srz.model.srz.Setting entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA, entityB); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void Delete() { try { rt.srz.model.srz.Setting entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.srz.model.srz.Setting entity = GetFirstSetting(); manager.Delete(entity); entity = manager.GetById(entity.Id); Assert.IsNull(entity); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public static Setting CreateNew(int depth = 0) { rt.srz.model.srz.Setting entity = new rt.srz.model.srz.Setting(); // You may need to maually enter this key if there is a constraint violation. entity.Id = System.Guid.NewGuid(); entity.Name = "Test Test "; entity.ValueString = "Test Test "; entity.UserId = new Guid("01000000-0000-0000-0000-000000000000"); using (rt.srz.business.manager.IOrganisationManager organisationManager = ObjectFactory.GetInstance <IOrganisationManager>()) { entity.Organisation = null; } using (rt.srz.business.manager.IWorkstationManager workstationManager = ObjectFactory.GetInstance <IWorkstationManager>()) { entity.Workstation = null; } return(entity); }
public void Update() { try { rt.srz.model.srz.Setting entityC = CreateNew(); manager.Save(entityC); manager.Session.GetISession().Flush(); manager.Session.GetISession().Clear(); rt.srz.model.srz.Setting entityA = GetFirstSetting(); entityA.Name = "Test Test "; manager.Update(entityA); rt.srz.model.srz.Setting entityB = manager.GetById(entityA.Id); Assert.AreEqual(entityA.Name, entityB.Name); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }