Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting MOQ setup code to vb.net from c#
    primarykey
    data
    text
    <p>I have a expression og MOQ (lambda/linq) in c#. When tried to conevert and use this code in vb.net, I am getting an error</p> <p><strong>C# code</strong></p> <pre><code>_dataLayerMock.Setup(x =&gt; x.SaveAccount(It.Is&lt;Account&gt;(a =&gt; a.AccountType == AccountType.Private))); </code></pre> <p><strong>Converted VB.net code</strong></p> <pre><code>_dataLayerMock.Setup(Function(x) x.SaveAccount(It.[Is](Of Account)(Function(a) a.AccountType = AccountType.[Private]))) </code></pre> <p><strong>Error</strong></p> <pre><code>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 </code></pre> <p>Could anyone help me out how to resolve this</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload