/// <summary> /// Save customer /// </summary> /// <param name="subject"></param> /// <returns></returns> public void SaveCustomer( SampleNHibernateTestApp.Customer subject) { using (var _session = this.c_sessionFactory.OpenSession()) { _session.SaveOrUpdate(subject); _session.Flush(); } }
public void GetById_Good() { this.c_insertedCustomerId = this.c_repository.GetAll()[0].TheId; var _expectedCustomer = new SampleNHibernateTestApp.Customer(); _expectedCustomer.TheId = this.c_insertedCustomerId; _expectedCustomer.FName = "Billy"; _expectedCustomer.LastName = "Stack"; _expectedCustomer.CreationAttribute = new SampleNHibernateTestApp.ModificationAttribute("BILLY", DateTime.UtcNow); var _actualCustomer = this.c_repository.GetById(c_insertedCustomerId); Assert.NotNull(_actualCustomer); Assert.Equal(_expectedCustomer.TheId, _actualCustomer.TheId); Assert.Equal(_expectedCustomer.FName, _actualCustomer.FName); Assert.Equal(_expectedCustomer.LastName, _actualCustomer.LastName); }
public void GetByIdAndLatestDate_Good() { this.c_insertedCustomerId = this.c_repository.GetAll()[0].TheId; var _expectedCustomer = new SampleNHibernateTestApp.Customer(); _expectedCustomer.TheId = this.c_insertedCustomerId; _expectedCustomer.FName = "Billy"; _expectedCustomer.LastName = "Stack"; _expectedCustomer.CreationAttribute = new SampleNHibernateTestApp.ModificationAttribute("BILLY", DateTime.UtcNow); var _actualCustomer = this.c_repository.GetById(c_insertedCustomerId); Assert.NotNull(_actualCustomer); Assert.Equal(_expectedCustomer.TheId, _actualCustomer.TheId); Assert.Equal(_expectedCustomer.FName, _actualCustomer.FName); Assert.Equal(_expectedCustomer.LastName, _actualCustomer.LastName); }