Hi
I'm trying to mock a interface, these are the expectations:
Using recorder As New RecordExpectations
mockedDataContext.GetCycleByBarn(Nothing)
recorder.Return(cycle)
mockedDataContext.GetActiveProductForCorral(5, today)
recorder.Return(product1)
mockedDataContext.GetLastFeedingDateByProduct(1, today)
recorder.Return(yesterdayAsSqlDateTime)
mockedDataContext.GetActiveProductForCorral(5, today)
recorder.Return(product2)
mockedDataContext.GetLastFeedingDateByProduct(1, today)
recorder.Return(yesterdayAsSqlDateTime)
mockedDataContext.GetActiveProductForCorral(-5, today)
recorder.Return(Nothing)
mockedDataContext.GetActiveProductForCorral(-10, today)
recorder.Return(Nothing)
End Using
As you can see, I only return prebuilt objects. These are the definitions of the dates I'm using:
Private today As DateTime = DateTime.Today
Private yesterday As DateTime = DateTime.Today.AddDays(-1)
Private yesterdayAsSqlDateTime As SqlDateTime = New SqlDateTime(yesterday)
The mockedDataContext object is created this way in a setup method:
mockedDataContext = DirectCast(MockManager.MockObject(GetType(IFeedDistributionCalculatorDataContext)).Object, IFeedDistributionCalculatorDataContext)
The problem is that when I run my test, it fails with the following message:
TypeMock.VerifyException:
TypeMock Verification: Method System.Data.SqlTypes.SqlInt32.op_Implicit() has 2 more expected calls
Method System.Data.SqlTypes.SqlDateTime.op_Implicit() has 2 more expected calls
I don't know which calls it's talking about! Am I missing something? I tried reproducing this with a small example, but it works, so I guess I'm doing something wrong.
Thanks in advance,
Julián