public void TestDatapiontRepositorySavaMethod()
        {
            NHUnitOfWork        nhUnitOfWork        = new NHUnitOfWork();
            DataPointRepository dataPointRepository = new DataPointRepository(nhUnitOfWork);

            DataPoint dataPointPre = dataPointRepository.FindBy(1);

            dataPointPre.Description = "MyID is" + Convert.ToString((dataPointPre.Id));

            dataPointRepository.Save(dataPointPre);

            DataPoint dataPointAfter = dataPointRepository.FindBy(1);

            nhUnitOfWork.Commit();

            Assert.AreEqual(dataPointPre.Description, dataPointAfter.Description);
        }
        public void TestDatapiontRepositoryUpdatAndCommitModthInUnitOfWork()
        {
            NHUnitOfWork        nhUnitOfWork        = new NHUnitOfWork();
            DataPointRepository dataPointRepository = new DataPointRepository(nhUnitOfWork);

            DataPoint dataPointPre = dataPointRepository.FindBy(1);

            dataPointPre.Description = "MyID is" + Convert.ToString((dataPointPre.Id));

            dataPointRepository.Save(dataPointPre);

            DataPoint dataPointAfter = dataPointRepository.FindBy(1);

            //如果不调用nhUnitOfWork.Commit(),
            //修改的数据还保存在ISession中,但是不会被保存到数据库
            //测试方法:
            //在Commit前后分别查看数据库的变化
            nhUnitOfWork.Commit();

            Assert.AreEqual(dataPointPre.Description, dataPointAfter.Description);
        }