I can't seem to get Mock.Arrange working with a dictionary parameter. I've included some sample code below. I was expecting ret to be equal to "test" but it is coming back as nothing. Have I got the syntax wrong in the Mock.Arrange() call?
<
TestClass
()> _
Public Class MyTests
<
TestMethod
()> _
Public Sub GetValue_ValueReturnedFromDatabase()
Dim ds As IDataService = Mock.Create(Of IDataService)()
Mock.Arrange(Function() ds.GetValue(Arg.AnyString, Arg.IsAny(Of Dictionary(Of String, Object)))).Returns("test")
Dim l As New LD(ds)
Dim ret As String = l.GetValue("xxx")
Assert.AreEqual("test", ret)
End Sub
End Class
Public Interface IDataService
Function GetValue(ByVal SQL As String, ByVal Params As Dictionary(Of String, Object)) As String
End Interface
Public Class DS
Implements IDataService
Public Function GetValue(ByVal SQL As String, ByVal Params As Dictionary(Of String, Object)) As String Implements IDataService.GetValue
Return "anything"
End Function
End Class
Public Class LD
Private _DataService As IDataService
Public Sub New(ByVal DataService As IDataService)
_DataService = DataService
End Sub
Public Function GetValue(ByVal Name As String)
Dim params As New Dictionary(Of String, Object)
Dim ret As String = _DataService.GetValue("Some SQL", params)
Return ret
End Function
End Class