vanderkleij/Smocks

Does not support Static Methods with an IEnumerable as an argument

Bromoc opened this issue · 0 comments

context.Setup(
                    () => Utilities.ApplyDivisors( It.IsAny<double>(), It.IsAny<IEnumerable<IDivisor>>() ) )
                    .Returns<double, IEnumerable<IDivisor>>( ( a, b ) => { return a; } );

When executing a Static method that calls ApplyDivisors I get the following exception:

System.InvalidCastException: Object must implement IConvertible.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Smocks.Setups.Setup1.<>c__DisplayClass2_02.b__0(Object[] args)
at Smocks.Setups.Setup1.GetReturnValue(Object[] arguments) at Smocks.Setups.Interceptor.InterceptMethod[TReturnValue](Object[] arguments, MethodBase originalMethod) at Smocks.Setups.Interceptor.Intercept[TReturnValue](Object[] arguments, MethodBase originalMethod) at .... ... Smocks.AppDomains.AppDomainContext.InvokeSerializableLambda[T](SerializableLambda1 serializableFunc, Object target, Object[] arguments)
at Smocks.AppDomains.AppDomainContext.Invoke[T](Action1 action, T parameter) at Smocks.Smock.RunAction(Action1 action, Configuration configuration)
at Smocks.Smock.Run(Configuration configuration, Action1 action) at Smocks.Smock.Run(Action1 action)

If I convert it to a List and create one that converts IEnumerable to List it then works. But i have a constraint that i can not alter the code i am testing.