I have the following in a test method:
// Setup the mock objects
MockRepository mocks = new MockRepository();
IDeliveryPeriodConverterFactory
deliveryPeriodConverterFactory =
mocks.CreateMock<IDeliveryPeriodConverterFactory>();
*** IRangeExtractor rangeExtractor =
mocks.CreateMock<IRangeExtractor>();
IDataBlockExtractor dataBlockExtractor =
mocks.CreateMock<IDataBlockExtractor>();
When executing the line with *** I get the following:
System.TypeLoadException: Method 'ExtractRanges' in type
'IRangeExtractorProxyb07f490417024a5fb04a8dc0a2cbaa1d' from assembly
'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=a621a9e7e5c32e69' does not have an implementation..
The IRangeExtractor interface is defined as:
/// <summary>
/// Interface for extracting ranges from a data array.
/// </summary>
public interface IRangeExtractor
{
/// <summary>
/// Extract data ranges from the specified array. Return
/// any warnings in the list of strings.
/// </summary>
/// <param name="data">Array of <b>Object</b>s to extract the
ranges from</param>
/// <param name="dataRanges">List to store the data ranges in</
param>
/// <param name="dateRanges">List to store the date ranges in</
param>
/// <param name="warnings">List to hold any warning messages</
param>
void ExtractRanges(
Object[,] data,
IList<IDataRange> dataRanges,
IList<IDateRange> dateRanges,
IList<String> warnings);
}
IDataRange & IDateRange just have a few getter properties on them.
Any ideas what the probelm could be?
Thanks
Stack trace:
at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32
handle, Module module)
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
at System.Reflection.Emit.TypeBuilder.CreateType()
at
Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType()
at
Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.GenerateCo de(Type
proxyTargetType, Type[] interfaces, ProxyGenerationOptions options)
at
Castle.DynamicProxy.DefaultProxyBuilder.CreateInterfaceProxyTypeWithoutTarg et(Type
theInterface, Type[] interfaces, ProxyGenerationOptions options)
at
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithoutTarget(Ty pe
theInterface, Type[] interfaces, ProxyGenerationOptions options)
at
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type
theInterface, Type[] interfaces, ProxyGenerationOptions options,
IInterceptor[] interceptors)
at
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type
theInterface, Type[] interfaces, IInterceptor[] interceptors)
at Rhino.Mocks.MockRepository.MockInterface(CreateMockState
mockStateFactory, Type type, Type[] extras)
at Rhino.Mocks.MockRepository.CreateMockObject(Type type,
CreateMockState factory, Type[] extras, Object[]
argumentsForConstructor)
at Rhino.Mocks.MockRepository.CreateMock[T](Object[]
argumentsForConstructor)
> I have the following in a test method: > // Setup the mock objects > MockRepository mocks = new MockRepository(); > IDeliveryPeriodConverterFactory > deliveryPeriodConverterFactory = > mocks.CreateMock<IDeliveryPeriodConverterFactory>(); > *** IRangeExtractor rangeExtractor = > mocks.CreateMock<IRangeExtractor>(); > IDataBlockExtractor dataBlockExtractor = > mocks.CreateMock<IDataBlockExtractor>();
> When executing the line with *** I get the following: > System.TypeLoadException: Method 'ExtractRanges' in type > 'IRangeExtractorProxyb07f490417024a5fb04a8dc0a2cbaa1d' from assembly > 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, > PublicKeyToken=a621a9e7e5c32e69' does not have an implementation..
> The IRangeExtractor interface is defined as: > /// <summary> > /// Interface for extracting ranges from a data array. > /// </summary> > public interface IRangeExtractor > { > /// <summary> > /// Extract data ranges from the specified array. Return > /// any warnings in the list of strings. > /// </summary> > /// <param name="data">Array of <b>Object</b>s to extract the > ranges from</param> > /// <param name="dataRanges">List to store the data ranges in</ > param> > /// <param name="dateRanges">List to store the date ranges in</ > param> > /// <param name="warnings">List to hold any warning messages</ > param> > void ExtractRanges( > Object[,] data, > IList<IDataRange> dataRanges, > IList<IDateRange> dateRanges, > IList<String> warnings); > }
> IDataRange & IDateRange just have a few getter properties on them.
> Any ideas what the probelm could be?
> Thanks
> Stack trace: > at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 > handle, Module module) > at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() > at System.Reflection.Emit.TypeBuilder.CreateType() > at > Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType() > at
> So something like? > IRangeExtractor rangeExtractor = > mocks.CreateMockWithRemoting<IRangeExtractor>();
> On Jun 11, 11:54 am, "Ayende Rahien" <aye...@ayende.com> wrote: > > Multi dimensional arrays are not supported. There is a CLR bug that > prevent > > this. > > You RemotingMock instead, that should work