Can't get Latest Rhino Mocks to work
-
05-07-2019 - |
Question
I don't get it - I've looked at the documentation, and I can't see what's wrong with this code:
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);
This is Rhino Mocks v3.6, for which I can only assume there are breaking changes that aren't in any of the documentation yet.
Solution
Never mind - I fixed it:
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);
It is late, I guess I couldn't see the wood for the trees. :)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow