我是新來的NUnit的測試,我想測試下面的構造:使用NUnit測試構造
public class IngredientDAONHibernate : NutritionLibrary.DAO.IngredientDAO
{
private Configuration config;
private ISessionFactory factory;
public IngredientDAONHibernate()
{
try
{
config = new Configuration();
config.AddClass(typeof(NutritionLibrary.Entity.Ingredient));
config.AddClass(typeof(Entity.Nutrient));
config.AddClass(typeof(Entity.NutrientIngredient));
factory = config.BuildSessionFactory();
}
catch (Exception e)
{
// logger.Error("Exception Occured", e);
}
}
測試存根如下:
[TestMethod()]
public void IngredientDAONHibernateConstructorTest()
{
IngredientDAONHibernate target = new IngredientDAONHibernate();
}
有人能幫助我關於如何開始的一些提示?謝謝!
在構造函數中發生的任何異常都不會冒泡,請嘗試將try-catch,運行您的單元測試。希望如果失敗了,你會知道它:) – PostMan 2009-11-05 03:39:46