Why would you want to Mock an XElement?

Just construct one that fulfills the requirements for your test and
pass it in.

On May 10, 11:31 am, Gary <[email protected]> wrote:
> I am trying to mock an System.Xml.Linq.XElement object, but can't even
> get one constructed. Here, briefly, is my code:
> ,----
> | XElement mockXML;
> | String[] xmlCtorArgs = new String[1];
> |
> | xmlCtorArgs[0] ="mockXML";
> | mockXML = mocks.StrictMock<XElement>(xmlCtorArgs);
> `----
> and get
> ,----
> | at Rhino.Mocks.MockRepository.MockClass(CreateMockState mockStateFactory, 
> Type type, Type[] extras, Object[] argumentsForConstructor)
> | at Rhino.Mocks.MockRepository.CreateMockObject(Type type, CreateMockState 
> factory, Type[] extras, Object[] argumentsForConstructor)
> | at Rhino.Mocks.MockRepository.StrictMock[T](Object[] 
> argumentsForConstructor)
> | at Testing.GPS.Assemblies.UPC.Test_System.FakeUPCData_Test.TestIt() in 
> C:\home\jg\WP187\UnitTests\UnitTest\Foo\My_Test.cs:line 38
> | --MissingMethodException
> | at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder 
> binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
> | at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, 
> Binder binder, Object[] args, CultureInfo culture, Object[] 
> activationAttributes)
> | at System.Activator.CreateInstance(Type type, Object[] args)
> | at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type targetType, 
> Type[] interfaces, ProxyGenerationOptions options, Object[] constructorArgs, 
> IInterceptor[] interceptors)
> | at Rhino.Mocks.MockRepository.MockClass(CreateMockState mockStateFactory, 
> Type type, Type[] extras, Object[] argumentsForConstructor)
> `----
> (line 38 being the "mocks.StrictMock" line above)
>
> I also tried using "object[] xmlCtorArgs = new object[1]" and that
> didn't work either.
>
> What am I doing wrong?
>
> --
> Gary        Please do NOT send me 'courtesy' replies off-list.

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.

Reply via email to