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

ArgumentNullException on Mock.Create()

3 Answers 21 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 22 Jan 2013, 09:39 AM
Hi,

I want to mock the webservice proxy class autogenerated by VS 2012, and when I call Mock.Create<portailSOAPClient>(), I have an ArgumentNullException.

   à System.IO.BinaryReader..ctor(Stream input, Encoding encoding, Boolean leaveOpen)
   à System.IO.BinaryReader..ctor(Stream input)
   à Telerik.JustMock.AssemblyBuilderHelper.ReadStrongKeyNamePairFromManifest()
   à Telerik.JustMock.AssemblyBuilderHelper.GetModuleBuilder(Boolean strongNamedAssembly)
   à Telerik.JustMock.AssemblyBuilderHelper.DefineModule(Type targetType)
   à Telerik.JustMock.Weaver.WeaverAssemblyBuilder.BuildDynamicAssembly(MethodBase methodBase, ModuleBuilder& moduleBuilder)
   à Telerik.JustMock.Weaver.DynamicInjector.Inject(Type targetType, MethodBase methodBase, MethodBase containerMethodInfo)
   à Telerik.JustMock.Weaver.DynamicInjector.Inject(Type targetType, MethodBase methodBase, MethodBase injectingMethod, Boolean force)
   à Telerik.JustMock.Weaver.DynamicInjector.Inject(Type targetType, MethodBase methodBase)
   à Telerik.JustMock.MockManager.SetupMock(Behavior behavior, Boolean static)
   à Telerik.JustMock.MockManager.CreateInstance()
   à Telerik.JustMock.FluentMock.Create()
   à Telerik.JustMock.Mock.Create(Type target, Action`1 settings)
   à Telerik.JustMock.Mock.Create(Type targetType, Constructor constructor, Behavior behavior)
   à Telerik.JustMock.Mock.Create[T](Constructor constructor)  

The proxy class generated by VS2012 is :
public partial class portailSOAPClient : System.ServiceModel.ClientBase<FiduPortail.portailSOAP>, FiduPortail.portailSOAP {}
     
Do you know how to resolve this issue.

Regards,

3 Answers, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 24 Jan 2013, 02:52 PM
Hello Benjamin,

Thank you for reporting this bug. We identified a possible reason for the issue. In order to investigate it further can you provide more information about your test runner?


All the best,
Mihail
the Telerik team
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
0
Benjamin
Top achievements
Rank 1
answered on 25 Jan 2013, 08:27 AM
I use MSTest in Visual Studio 2012 Premium.
Here is the beginnning of the test :

		[TestMethod()]		
		public void GetLicencesFromPortail_SIMEO()
		{
			string codeClientPortail = "PEB10";
			string codePersonnel = "ZIOZ";
			string codeServiceSimeo = "59";
			string dateDebutSimeo = "2013/02/01";
			string codeModuleSimeo = "SW";
			
			var mock = Mock.Create<FiduPortail.portailSOAPClient>();

The ArgumentNullException is thrown on the last line.
0
Mihail
Telerik team
answered on 28 Jan 2013, 09:48 AM
Hello Benjamin,

We fixed the issue. The fix will be included in the next JustMock release scheduled for the end of February. In case you want to try it earlier, I would recommend you to open a support ticket in order to get a private JustMock build.


Regards,
Mihail
the Telerik team
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Tags
General Discussions
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Benjamin
Top achievements
Rank 1
Share this question
or