Error: Arrange a method with a params argument

3 posts, 0 answers
  1. Kevin Schneider
    Kevin Schneider avatar
    48 posts
    Member since:
    Jan 2008

    Posted 08 Jun 2011 Link to this post

    I am trying to arrange the following:

    TEntity GetByKey(params object[] keyValues);

    using:

    const long id = 1;
    Mock.Arrange(() => _appSettingRepository.GetByKey(id)).Returns(() => null);

    This is failing with the following:

    Get_app_setting_by_invalid_key_should_return_null' failed: System.NullReferenceException : Object reference not set to an instance of an object.
    at ....Ž(UnaryExpression expression)
    at ..ˆ(Expression expression)
    at ....(Expression argExpression)
    at ....(Int32 i, Expression chidExp)
    at ..[T](IEnumerable`1 enumeration, Action`2 action)
    at ..Œ(MethodCallExpression expression)
    at ..ˆ(Expression expression)
    at ..(Object obj, Type mockTarget, MethodInfo method, Expression expression)
    at ..(Expression`1 expression)
    at Telerik.JustMock.Mock...€( x)
    at ..[TDelgate,TReturn](† instruction, Func2`2 function)
    at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)
  2. Kevin Schneider
    Kevin Schneider avatar
    48 posts
    Member since:
    Jan 2008

    Posted 09 Jun 2011 Link to this post

    I should have also mentioned I am using version 2011.1.331.1
  3. DevCraft R3 2016 release webinar banner
  4. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 13 Jun 2011 Link to this post

    Hi Kevin,

    You are right about the issue. It is throwing exception when params of type object[] is passed with value type argument(s). However the issue is fixed and should you require an internal build, please let us know and in that case, please also open up a support ticket (Since we can't send internal builds in public forum) so that we can send you one.

    In addition this will also be included in a service pack to be released shortly; therefore you can wait for that as well if not urgent.

    Kind Regards,
    Ricky
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top