RajOpteamix / moq

Automatically exported from code.google.com/p/moq
Other
0 stars 0 forks source link

Setup method issue in vb.net #336

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have a c# code which working fine. When tried to convert this c# to vb.net I 
am facing problem

C# code
_dataLayerMock.Setup(x => x.SaveAccount(It.Is<Account>(a => a.AccountType == 
AccountType.Private)));  
VB.Net code
_dataLayerMock.Setup(Function(x) x.SaveAccount(It.[Is](Of Account)(Function(a) 
a.AccountType = AccountType.[Private])))

Error:
Error   1   Overload resolution failed because no accessible 'Setup' can be called 
with these arguments:
    'Public Function Setup(Of TResult)(expression As System.Linq.Expressions.Expression(Of System.Func(Of ConsoleApplication1.IDataLayer, TResult))) As Moq.Language.Flow.ISetup(Of ConsoleApplication1.IDataLayer, TResult)': Expression does not produce a value.
    'Public Function Setup(Of TResult)(expression As System.Linq.Expressions.Expression(Of System.Func(Of ConsoleApplication1.IDataLayer, TResult))) As Moq.Language.Flow.ISetup(Of ConsoleApplication1.IDataLayer, TResult)': Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.
    'Public Function Setup(expression As System.Linq.Expressions.Expression(Of System.Action(Of ConsoleApplication1.IDataLayer))) As Moq.Language.Flow.ISetup(Of ConsoleApplication1.IDataLayer)': Expression does not produce a value. D:\Araamudhan\Project\Amex\Maven-NPanday\Application\ClassLibrary\LinqTest\LinqTest\BusinessLayerTest.vb    20  9   LinqTest

Could anyone let me know how the resolve this

Thanks,
P.Araamudhan

Original issue reported on code.google.com by JAYAPRAK...@gmail.com on 16 Mar 2012 at 5:15