I'm trying to verify the parameters on a stored proc that takes several parameters.
Here's the code I'm using:
private void QueuePlayerUpdate(int playerID, bool newAccount, bool editedAccount, bool newPlayer, bool editedPlayer, int userID, int applicationID, int workstationID)
{
using (SqlConnection conn = new SqlConnection(OasisSqlDataManager.ConnectionString()))
using (SqlCommand command = new SqlCommand("dbo.CPW_INS_PLAYER_PRESTAGE", conn))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@iPLAYER_ID", playerID);
command.Parameters.Add("@iAccountNew", newAccount);
//...more parameters
conn.Open();
command.ExecuteNonQuery();
}
}
Here's my test:
[Test] public void TestQueueNewPlayer()
{
MockManager.MockAll(typeof (SqlCommand)).ExpectAndReturn("ExecuteNonQuery", 1, 1);
Mock parametersMock = MockManager.Mock(typeof(SqlParameterCollection));
parametersMock.ExpectUnmockedCall("Add", 1).Args("@iPLAYER_ID", 1);
parametersMock.ExpectUnmockedCall("Add", 1).Args("@iAccountNew", false);
//...more parameters
new v11OneCardBridgeDAL().QueueNewPlayer(1, 1, 1, 1);
}
I'm getting this error:
SqlParameterCollection.Add expected 2 parameters but received 1
Thanks.
Scott C.