我的VBA代码中有一个函数,它将记录集作为参数,我想为它编写测试,而不必访问实际的数据库。
关于我将如何处理的任何想法?
Private Function GetAssignData(ByRef rst As DAO.Recordset) As AssignData
'Set up our details
iTeam = 0
iPerson = -1
With rst
ABC_ID = .Fields("ABC Inventory ID")
PROD_OP_ID = .Fields("Prod Op Type ID")
INTEG_OP_ID = .Fields("Integ Issue Type ID")
'
'DO ALL OF OUR REALLY REALLY IMPORTANT LOGIC HERE
'
'Assign Integ Tickets
If .Fields("Ticket Type ID") = 1 Then
iTeam = 2
Else
iTeam = 1
End If
'Assign Prod Ops Tickets
End With
ReturnAssignData:
'And send our final data :D
GetAssignData.iTeam = iTeam
GetAssignData.iPerson = iPerson
End Function