This is a migrated thread and some comments may be shown as answers.

Error: Arrange a method with a params argument

2 Answers 79 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kevin Schneider
Top achievements
Rank 1
Kevin Schneider asked on 09 Jun 2011, 03:55 AM
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 Answers, 1 is accepted

Sort by
0
Kevin Schneider
Top achievements
Rank 1
answered on 09 Jun 2011, 01:48 PM
I should have also mentioned I am using version 2011.1.331.1
0
Ricky
Telerik team
answered on 13 Jun 2011, 04:28 PM
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
Tags
General Discussions
Asked by
Kevin Schneider
Top achievements
Rank 1
Answers by
Kevin Schneider
Top achievements
Rank 1
Ricky
Telerik team
Share this question
or