Help, VB syntax problem?

7 views
Skip to first unread message

Steve Campbell

unread,
Jul 17, 2008, 1:50:52 PM7/17/08
to Rhino.Mocks
Using Rhino v3.5.0.2 I have the following code (my first attempt at
using Rhino):

<TestMethod()> _
Public Sub TestSimpleAuthenticatePass()
Dim mocks As New MockRepository()
Dim mockProv = mocks.DynamicMock(Of
System.Web.Security.MembershipProvider)()
Using mocks.Record()
Expect.Call(mockProv.ValidateUser("john",
"password")).Return(True)
End Using
End Sub

Expect.Call gives a compile-time error of "overload resolution failed
because no accessible 'Expect' accepts this number of arguments".

Looking at C# examples, this seems like the correct syntax. Is the
VB.NET syntax different?

Steve Campbell

unread,
Jul 17, 2008, 4:49:12 PM7/17/08
to Rhino.Mocks
I have worked around the problem by not using the Expect syntax,
replacing that line with:
mockProv.ValidateUser("john", "password")
LastCall.Return(True)

I'm assuming at this point that the Expect syntax is simply
incompatible with VB.NET. Is that true?


~Steve

Ayende Rahien

unread,
Jul 18, 2008, 1:23:05 AM7/18/08
to Rhino...@googlegroups.com
In many cases, it seems so.

ulu

unread,
Jul 18, 2008, 2:22:16 PM7/18/08
to Rhino.Mocks
Looks like it's changed, was working for me in 3.4.

Can you try Expect.Call (Of Boolean) (mockProv.ValidateUser("john",
"password")).Return(True) ?

Steve Campbell

unread,
Jul 22, 2008, 9:42:58 AM7/22/08
to Rhino.Mocks
On Jul 18, 1:22 pm, ulu <uluhonol...@yandex.ru> wrote:
> Looks like it's changed, was working for me in 3.4.
>
> Can you try Expect.Call (Of Boolean) (mockProv.ValidateUser("john",
> "password")).Return(True) ?
>

Nope, same error as before.

~Steve

ulu

unread,
Jul 22, 2008, 3:35:06 PM7/22/08
to Rhino.Mocks
Are you sure that it says "no accessible 'Expect' accepts this number
of arguments" ("Expect", not "Call")? Could it be that you are using a
method called Expect somewhere?

BTW if you are doing webforms, you could try Ivonna for testing
(http://sm-art.biz/Ivonna.aspx).

ulu

Jeremy Wiebe

unread,
Sep 4, 2008, 9:36:48 AM9/4/08
to Rhino.Mocks
Yes, it's 'Expect' and not 'Call' in the error message.

I found that I can work around it by fully qualifying the Expect type.

Rhino.Mocks.Expect.Call(obj.Method()).Return(returnObj)
Reply all
Reply to author
Forward
0 new messages