RajOpteamix / moq

Automatically exported from code.google.com/p/moq
Other
0 stars 0 forks source link

Mock Method Default Return Value for IEnumerable generic is Empty IEnumerable instead of null #341

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create interface method with signature like: 
public T Get<T>(string objName) where T :class;
2. Create a mock of the interface.
3. Call Get<IEnumerable<string>>("whatever") on the mock object

What is the expected output? What do you see instead?
Expected: null
Actual: empty IEnumerable<string>

What version of the product are you using? On what operating system?
4.0.0.0

Please provide any additional information below.

Original issue reported on code.google.com by Narcotic...@gmail.com on 19 Apr 2012 at 7:32

GoogleCodeExporter commented 9 years ago
This is by design. You can override the default value by using 
mock.SetReturnsDefault

Original comment by dan...@cazzulino.com on 19 Apr 2012 at 8:21