OK.
The real problem was found and I'm guessing its in the gray area between a feature and a bug :twisted:
(Just joking its a bug)
As I mentioned in a previous post, the change in behavior is actually caused by the static constructor.
While in Test1 the statement:
SqlParameterCollection mockedParams = RecorderManager.CreateMockedObject<SqlParameterCollection>(Constructor.Mocked);
caused the cctor to be executed (the default behavior in this case is not to mock the constructors of the object created)
In Test2 the real cctor was not executed in any stage.
so how this effected the test?
well that relate to the call to:
sqlCmd.Parameters.AddWithValue("@EndDate", end_date);
which as the test is written is
not mocked, and causes the "real" implementation to be executed.
unfortunately this call succeed if and only if the real cctor was done,
now after this long explanation I'm guessing that were having two real issues here:
:?: why is there a change in the behavior between the test?
Answer: Well there shouldn't be and we will work on fixing it.
:?: how can a user understand from the exception thrown how to solve this?
Answer: He probably can't. Thats why were working on changing that. (This is part of a bigger issue which relates to the ability to mock fields.)
hope this explain everything
feel free to post if you more questsions