2009-10-22 61 views
0

我不明白這一點 - 我看過的文檔,我也看不出有什麼不對這個代碼:無法獲得最新的犀牛嘲笑工作

var mocks = new MockRepository(); 
var repository = mocks.StrictMock<IRecipeRepository>(); 
IList<Recipe> recipes = new List<Recipe>(); 
recipes.Add(new Recipe { ID = 1, Name = "Fish" }); 
recipes.Add(new Recipe { ID = 2, Name = "Chips" }); 

// This line doesn't compile: 
Expect.Call(() => repository.All()).Return(recipes); 

這是犀牛製品v3.6,對此,我只能假設有一些尚未出現在任何文檔中的重大更改。

回答

1

沒關係 - 我固定它:

var mocks = new MockRepository(); 
var repository = mocks.StrictMock<IRecipeRepository>(); 
IList<Recipe> recipes = new List<Recipe>(); 
recipes.Add(new Recipe { ID = 1, Name = "Fish" }); 
recipes.Add(new Recipe { ID = 2, Name = "Chips" }); 

Expect.Call(repository.All()).Return(recipes); 

晚了,我想我可以看不到樹木,不見森林。 :)