Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6061801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:58:43+00:00 2026-05-23T08:58:43+00:00

So, I have a method with this signature: IList<Mail> FindFilteredPaged( QueryFilter filter, int pageIndex,

  • 0

So, I have a method with this signature:

IList<Mail> FindFilteredPaged(
   QueryFilter filter, 
   int pageIndex, 
   int pageSize, 
   out int totalRecords);

and I wanna setup expectation so I can check that the filter parameter is null. The problem comes with the final out paremter. My current expectation setup is like this:

Expect
   .Call(registryMailService.FindFilteredPaged(
      Arg<QueryFilter<IncomingMail>>.Is.Anything,
      Arg<Int32>.Is.Anything,
      Arg<Int32>.Is.Anything,
      out Arg<Int32>.Out(20).Dummy))                         
   .Callback<QueryFilter<IncomingMail>, Int32, Int32>((p1, p2, p3) => 
   {
       filterWasNotSpecified = p1 == null;
   });

No luck, however. The setup crash with an exception saying Callback arguments didn't match the method arguments. Any suggestion on how to do this? Is there a way to just use the first argument and skip the rest?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:58:44+00:00Added an answer on May 23, 2026 at 8:58 am

    You may be running into the following:

    “A lambda expression cannot directly capture a ref or out parameter from an enclosing method.”

    http://msdn.microsoft.com/en-us/library/bb397687.aspx

    Edit: You can create / use a custom delegate … for example declare…

    public delegate void SomeAction<T1, T2, T3>( out T1 a, ref T2 b, T3 c );
    

    then in your test…

    SomeAction<int, string, string> fakeDoSomething  = ( out int outParam, ref string refParam, string param ) =>
                {
                    outParam = 123;
                    refParam = "123";
                };
    
            using ( m_Mocks.Record() )
            {
                Expect.Call( () => m_MockService.DoSomething( out outInt, ref refString, someString ) ).Do( fakeDoSomething );
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method with this signature: IEnumerable<string> GetCombinations(string s, int length) And I
I have a method which have this signature public static IList<T> GetBy<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression)
I have this method signature: public int nrOfEntities(Class<? extends MailConfirmation> clazz, User user, String
I have a method with this signature, and another method that will be the
I have this method signature in a jersery servlet. The servlet is being reached
Finding myself in the situation where I have a method with this signature void
Say I have a method signature like this: protected override void Initialize(params object[] parameters)
I have a method with this signature: protected final Map<String, Object> buildOutputMappings( AbstractDataObject ado,
I have a method signature that looks like public void (Foo<T> foo) In this
I have a method with a signature string GenericMethod<T>(); Usually you'd call this simply

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.