Hi All,
Below given is the method i need to invoke the test
AgentDataAccess.GetAgents(instanceId) call returns a Idatareader, while i execute the test it gave an error
TypeMock.VerifyException:
TypeMock Verification: Unexpected Call to System.Data.IDataReader.Dispose().
public static List<Agent> GetAgents(int instanceId)
{
return Agent.CreateAgents(AgentDataAccess.GetAgents(instanceId));
}
[testMethod]
public void TestMethod()
{
Mock mockAgentDataAccess = MockManager.Mock(typeof(mockAgentDataAccess));
MockObject mockIDataReader = MockManager.MockObject(typeof(IDataReader));
mockAgentDataAccess.ExpectAndReturn("GetAgents", mockIDataReader.Object as IDataReader);
mockIDataReader.ExpectAndReturn("Read",true);
}
List<Agent> results = AgentController.GetAgents(1);
MockManager.Verify();
Can you let me know why i am getting this error
i have tried with mockIDataReader.ExpectCall(dispose());
The dispose verification exception went away , but it gave me another verification exception getOrdinal()
It looks like it is going a chain way, What am i missing here
thanks
thomson