tags:

views:

83

answers:

1

I am trying to test that a property has been set but when I write this as a unit test:

moqFeed.VerifySet(Function(m) m.RowAdded = "Row Added")

moq complains that "Expression is not a property setter invocation"

My complete code is

Imports Gallio.Framework
Imports MbUnit.Framework
Imports Moq

<TestFixture()> Public Class GUI_FeedPresenter_Test
    Private moqFeed As Moq.Mock(Of IFeedView)
    <SetUp()> Sub Setup()
        moqFeed = New Mock(Of IFeedView)
    End Sub
    <Test()> Public Sub New_Presenter()
        Dim pres = New FeedPresenter(moqFeed.Object)
        moqFeed.VerifySet(Function(m) m.RowAdded = "Row Added")
    End Sub
End Class

Public Interface IFeedView
    Property RowAdded() As String
End Interface

Public Class FeedPresenter
    Private _FeedView As IFeedView

    Public Sub New(ByVal feedView As IFeedView)
        _FeedView = feedView
        _FeedView.RowAdded = "Row Added"
    End Sub
End Class

I can't find any examples of moq in VB, I would be grateful for any examples.

+1  A: 

See my question http://stackoverflow.com/questions/3229847/using-moqs-verifyset-in-vb-net for the solution to this.

Nick