Moq and Moq Options

I can not find the versions of moq and moq contrib, which are string. I probably just have a google bug.

Details:

Is there a version of moq.contrib that works with moq version 4.0.10827, the most recent from http://code.google.com/p/moq-contrib/downloads/list gives me an error

CA0058: Reference assembly 'Moq, Version = 4.0.812.4, Culture = neutral, PublicKeyToken = 69f491c39445e920' not found. This assembly is necessary for analysis and was referenced by: ...

Or there is a resource for downloading Moq 4.0.812.4, since http://code.google.com/p/moq/downloads/list has only 4.0.10827

Even installing both of nuget did not help.

Thanks.

+4
source share
3 answers

Moq Contrib seems to have a new home: http://moqcontrib.codeplex.com/ . There are no downloads and not too much information about the current status of the project.

At least they are aware of this incompatibility issue: http://moqcontrib.codeplex.com/discussions/255319 but there seems to be no fix for it or a new lib relationship since last April.

You can try to fix yourself dependecy and build the library from the source.

Or

I found this package nuget Moq.Contrib.Indy

Independent implementation of the Moq.Contrib project, with modern links to Moq and Autofac

I have not tried it, but it might be worth a try ...

+4
source

I fixed it as follows.

  • Take the source from

http://code.google.com/p/moq-contrib/downloads/detail?name=Moq.Contrib-0.2-src.zip

  • Then change the target structure to 4.0

  • Add moq 4.0 instead of existing moq

  • Comment on VerifyAll validation and verification methods. There the methods were virtual in 2.0 moq contrib

  • Rename method calls

  • MockFactory for MockRepository ExpectGet to SetupGet

The project has a link to Autofac. I did not try to change this link to the latest version of autofac.

+4
source

You can configure bindingRedirect in app.config:

 <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral" /> <bindingRedirect oldVersion="4.0.0.0-4.2.1312.1622" newVersion="4.2.1312.1622" /> </dependentAssembly> </assemblyBinding> </runtime> 

where 4.2.1312.1622 should be replaced with the latest version of Moq.

0
source

Source: https://habr.com/ru/post/1402414/


All Articles