2
在呈現者的方法中,我期望調用一個視圖方法。該方法還傳遞從服務方法中提取的數據(未被模擬)。該服務方法基本上獲取數據從數據庫返回表(使用LINQ to SQL)。現在,當我寫這篇文章的測試無法找出犀牛模擬問題
List<customers> cus = expecteddata;
view.AssertWasCalled(v => v.InitializeCustomersForSelectedCity(cus));
Rhino.Mocks.Exceptions.ExpectationViolationException: ICustomerListView.InitializeCustomersForSelectedCity(System.Collections.Generic.List`1[DAL.Customer]); Expected #1, Actual #0.
我在主持人正在測試的代碼
public void HandleSelectedCity(int City)
{
selectedCity = City ;
_custometListForm.InitializeCustomersForSelectedCity(_CustomerListService.GetActiveCustomersForSelectedCity(selectedCity));
}
當我忽略的參數,測試工作罰款 可能是什麼問題?
好的,謝謝。我決定把測試分成2 - 1個互動測試,方法被調用。而且,另一個測試服務方法 – 2010-02-03 06:58:11