Hello,
I've two static method with the same name but with different number of parameters. One function is invoke from other:
public static DataSet GetDataSet(string storedProcedure, SqlParameter[] arParams)
{
string connectionString = (string)Settings.ConnectionString[Datasource.MyDatasource];
return GetDataSet(storedProcedure, arParams, connectionString);
}
public static DataSet GetDataSet(string storedProcedure, SqlParameter[] arParams, string connectionString)
{
return GetDataSet(false, storedProcedure, arParams, connectionString);
}
I want to test first method so i should check if second method is invoke with correct parameters. I do it as below:
[Test]
public void GetDataSetTest1()
{
System.Collections.Hashtable ht = new System.Collections.Hashtable();
using (RecordExpectations r = RecorderManager.StartRecording())
{
r.ExpectAndReturn(Settings.ConnectionString[""], ht);
r.ExpectAndReturn(Common.GetDataSet("storedProcedure", null, null), new System.Data.DataSet()).CheckArguments();
}
Common.GetDataSet("storedProcedure", null);
}
Unfortunately i get error:
GetDataSetTest1 : TypeMock.VerifyException :
TypeMock Verification: Call to Common.GetDataSet() expected 3 arguments but was called with 2
When I change name of one of my static methods it works OK, but I cant change it. Many references......
Is another solution for this case?
br
Tadeusz