0

TryGetValuesTKeyと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)

この場合、私は接続が何かである必要があります。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