views:

300

answers:

1

I remember that to set expectations on methods that return void in C# one has to write:

mockedRepository.Expect(() => mr.AddUser(someUser)).DoOtherStuff()

where AddUser returns void.

How to achieve the same in VB.NET?

EDIT:

I've found similar question. May be helpful: How to mock a method with Rhino Mocks in VB.NET .

+1  A: 

You have to use a little trick

<test> _
Public Sub Test
  mockedRepository.Expect(Function(x) domock(x)).DoOtherStuff()
End SUb

Private Function domock(Byval x as whateverxis) as boolean
  x.AddUser(someUser)
  return false 'but actualy who cares
End Function

All this mess is solved in VB10

chrissie1