我的Person.hbm.xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="property">
  <class name="Demo.Person, Demo" table="tb_person">
    <id name="PerID" column="per_id" type="Int64" unsaved-value="0" >
      <generator class="assigned"/>
    </id>
<bag name="MailList" table="tb_mail" access="nosetter.pascalcase-m-underscore" inverse="true" cascade="all" lazy="true">
      <key column="per_id"/>
      <one-to-many class="Demo.Mail,Demo"/>
</bag>
我的Person类:
namespace Demo
{
 public class Person
    {
        private long perID;
        private List<Mail> mailList;
        public Int64 PerID
        {
            get { return perID; }
            set { perID = value; }
        }
        public List<Mail> MailList
        {
            get { return mailList; }
            set { mailList = value; }
        }
     }
}
我的测试类:
namespace DemoTest
{
    [TestFixture]
    public class PersonTest
    {
        [Test]
        public void GetAllPersonTest()
        {
            PersonDao peronDao = new PersonDao();
            List<Person> list = peronDao.GetAll();
            Assert.IsNotNull(list, "人员为空");
            Assert.AreEqual(0, list.Count, "人员数等于0");
            Console.WriteLine("人员数等于{0}", list.Count.ToString());
        }
    }
}
Nunit的错误信息:
DemoTest.PersonTest.GetAllPersonTest : NHibernate.PropertyNotFoundException : Could not find field 'm_MailList' in class 'Demo.Person'我的问题:为什么在使用泛型时,其他基本类型没问题,可以测试通过,但是List类型的属性MailList在Nuit测试下会发生错误:'m_MailList' ,请问怎样解决这个问题?先谢谢了。