提示“調用目標發生異常”,找了半天,在文章NHibernate 1.2 Migration
找到了這麼一段
Changes in ADO.NET provider assembly loading
NHibernate 1.2 now uses Assembly.Load() instead of Assembly.LoadWithPartialName() to load driver assemblies. This means that it will no longer look for the highest-versioned assembly in the Global Assembly Cache (GAC), which was sometimes undesirable. Instead, it is now your responsibility to either put the provider assembly into the application directory, or add a qualifyAssembly element to the application configuration file, specifying the full name of the assembly.
For example, if you are using MySQL Connector/.NET, you should either put MySql.Data.dll into the application directory (or some other directory from where Assembly.Load() can pick it up), or put it in the GAC and add a qualifyAssembly element to the configuration file:
<qualifyAssemblypartialName="MySql.Data"fullName="MySql.Data, Version=..., PublicKeyToken=..."/>
於是找到MySql.Data.dll,並拷貝到單元測試的目錄下,上面的錯誤提示沒了。