0

我有一个TryGetValues接收 TKey 和 ByRef 一个 TValue 的函数,当我模拟这个函数时我需要返回一些东西。我需要 TValue 的值,因为稍后在我测试的方法中我将需要它。我用来测试它的方法是:

Dim agent = Mock.Get(Of ICalcAgent)()
Dim connections As IList(Of ICalcMapConnection) = Nothing
agent.CalcMap = Mock.Get(Of ICalcMap)()
agent.CalcMap.Stub(Function(x) x.TryGetCategoryChildren(agent, connections)).IgnoreArguments().OutRef(agent, connections).Repeat.Once().Return(True)

在这种情况下,我需要 Connections 成为某种东西。我如何用 Rhino 做到这一点?

Sub AddConnection(ByRef cnn As ICalcMapConnection)
Sub AssignWeightToConnections()
Function TryGetCategoryParents(ByRef agent As ICalcAgent, ByRef parentsList As IList(Of ICalcMapConnection)) As Boolean
Function TryGetCategoryChildren(ByRef agent As ICalcAgent, ByRef childrenList As IList(Of ICalcMapConnection)) As Boolean
ReadOnly Property MapType() As MapType
Function GetMaxWeight(ByVal categoryId As Integer) As Integer
Function HasConnection(ByVal connection As ICalcMapConnection) As Boolean
Function HasCategory(ByVal categoryId As Integer) As Boolean
Function GetLeafCategories() As IEnumerable(Of Integer)
Function GetCategoryDefinition(ByRef agent As Interfaces.ICalcAgent) As ICalcMapConnection
Function GetLeafConnection(ByVal categoryId As Integer) As ICalcMapConnection
Sub RegisterCostCollectorCategory(ByVal connection As ICalcMapConnection)
Sub RegisterWBSCategory(ByVal connection As ICalcMapConnection)
Sub RegisterManualCategory(ByVal connection As ICalcMapConnection)

Function GetCostCollectorLeafCategories() As IList(Of ICalcMapConnection)
Function GetWBSLeafCategories() As IList(Of ICalcMapConnection)
Function GetManualCategories() As IList(Of ICalcMapConnection)


Sub AddWbs(ByVal wbsId As Integer)
Function HasWbs(ByVal wbsId As Integer) As Boolean

Sub AddCostCollector(ByVal costCollectorId As Integer)
Function HasCostCollector(ByVal costCollectorId As Integer) As Boolean
4

0 回答 0