Did you figure this out? If not, here is what I do (regarding the
first problem), create
a fake function that can be used in the Lambda expression. It's way
more ugly but it makes it work in VB.

Here's an example, in the FakeErrorMessage i call the method or
property that doesn't have
ant return value...

    view.Stub(Function(x As IObjectSelectionView) FakeErrorMessage(x,
validationResult))

    Private Function FakeErrorMessage(ByVal e As IObjectSelectionView,
ByVal validationResult As ValidationResult) As Boolean
        e.ErrorMessages = ValidationResult.ErrorMessages
        Return True
    End Function


There's probably an easier way to do this, but haven't found it
yet :o)


Kind Regards
Robert


On 11 Dec 2009, 16:23, Tarpan <[email protected]> wrote:
> The error is about limited Lambda expressions in VB - Lambda
> expression has to return a value. Exact error text is
> --------------
> Error   2       Overload resolution failed because no accessible
> 'AssertWasCalled' can be called with these arguments:
>     Extension method 'Public Sub AssertWasCalled(action As System.Func
> (Of IDataSaver, Object))' defined in
> 'Rhino.Mocks.RhinoMocksExtensions': Expression does not produce a
> value.
>     Extension method 'Public Sub AssertWasCalled(action As
> System.Action(Of IDataSaver))' defined in
> 'Rhino.Mocks.RhinoMocksExtensions': Expression does not produce a
> value.  D:\GMS5000\Server\TDD_SmartTruck\CRFTagLocator_specs.vb 132     9
> TDD_SmartTruck
> --------------
> Don't spend time to understand the error message - it just means that
> "Lambda expression has to return a value".
>
> On Dec 11, 8:21 am, Tim Barcz <[email protected]> wrote:
>
>
>
> > What is the error you get?
>
> > Sent from myiPhone
>
> > On Dec 10, 2009, at 9:39 PM, Tarpan <[email protected]> wrote:
>
> > > Hi there,
>
> > > I like AAA syntax a lot, but using it in VB may be pain in a butt. I'm
> > > thinking to write a few extensions for RhinoMocks to support VB
> > > better, but first just wondering - maybe somebody can recommend a
> > > ready solution?
>
> > > Few examples:
>
> > > 1) AssertWasCalled for a Sub:
> > >   DataSaver.AssertWasCalled(Function(x) x.Save(Data))
> > >   looks easy but does not work in VB
>
> > > extension like this may help
> > >   DataSaver.AssertSubWasCalled(Of IDataObject)(AddressOf
> > > DataSaver.Save, Data)
>
> > > 2) Repeat
> > >   DataSaver.AssertWasCalled(Function(x) x.SaveFunc(Data), function(o)
> > > o.Repeat.Once)
> > >   looks easy but does not work in VB
>
> > > and probably few others VB issues
>
> > > --
>
> > > You received this message because you are subscribed to the Google  
> > > Groups "Rhino.Mocks" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to 
> > > [email protected]
> > > .
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/rhinomocks?hl=en
> > > .
-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.


Reply via email to