
moq - issue #302
Verify seems to keep the reference of the object, as opposed to a "snapshot" of the value at the time.
I can understand why this happens, and how it can be a pain to work around. NUnit tests attached that show the issue. First discovered it with a dictionary, but went ahead and tried it with a regular class as well.
- MoqTest.cs 1.41KB
Comment #1
Posted on Mar 17, 2011 by Quick MonkeyMoq doesn't keep anything. It evaluates at the time it needs to evaluate, and accesses the variables, fields, etc. at that time, which is the time when the lambdas are evaluated.
That isn't going to change. It's totally out of scope for it to do any deep cloning of the objects involved.
That said, you could do that clonning at whatever point in time it makes sense for your scenario.
Status: WontFix
Labels:
Type-Defect
Priority-Medium