Пример #1
0
 /// <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();
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }