ninject / Ninject.MockingKernel

Extension for Ninject aiding testability in Moq, NSubstitute, and FakeItEasy
http://ninject.org/
Other
62 stars 25 forks source link

Update Moq to version 4.2 #15

Closed kevinkuszyk closed 10 years ago

kevinkuszyk commented 10 years ago

Hi Remo,

I've updated the Moq package to the latest 4.1 today. I also updated the FluentAssertions dependency to use the NuGet package.

Can you push this update to NuGet as we want to update our solution to to the latest Moq, but we are blocked at the moment by Ninject.MockingKernel.Moq.

Thanks, Kevin

philippdolder commented 10 years ago

@kevinkuszyk the build fails (https://teamcity.bbv.ch/viewLog.html?buildId=3580&buildTypeId=bt34&tab=buildLog) you can login as guest.

Can you please have a look into it? We had some troubles with the builds lately. Come back to me if you think it is a build server related issue.

kevinkuszyk commented 10 years ago

I've fixed the initial build errors, but now the silverlight-5.0 version is not building. I'm not sure why - can you take a look let me know what's wrong?

philippdolder commented 10 years ago

Will have a look into it tomorrow

kevinkuszyk commented 10 years ago

@philippdolder did you ever get a chance to look at this?

How close to having a stable release from master are you? It looks like Moq 4.1 restriction has already been lifted there and that would enable us to upgrade.

jarl-dk commented 10 years ago

Please consider upgrading to Moq 4.2

philippdolder commented 10 years ago

@kevinkuszyk I'm sorry. couldn't look into it :-( could you update to Moq 4.2 then I will merge and create a new NuGet package, if necessary, I'll do and verify it manually. Promised

kevinkuszyk commented 10 years ago

@philippdolder I'll try to find some time next week to update it.

kevinkuszyk commented 10 years ago

@philippdolder I've updated Moq to the latest. It builds fine in VS, but not with the build-release.cmd batch file. I'm afraid I don't know much NAnt, so can you take a look?

I also updated NSubstitute while I was there.

philippdolder commented 10 years ago

@kevinkuszyk Sorry, I was sick the last couple of days. Did you follow the instructions in HowToBuild.txt before running build-release.cmd?

philippdolder commented 10 years ago

Initially I get the following error when running the script

     [copy] Copying 8 files to 'C:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests'.
      [csc] Compiling 7 files to 'C:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests\Ninject.MockingKernel.Test.dll'.
      [csc] c:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests\Ninject.MockingKernel.Moq.dll: error CS1705: Assembly 'Ninject.MockingKernel
.Moq, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' uses 'Moq, Version=4.2.1402.2112, Culture=neutral, PublicKeyToken=69f491c3944
5e920' which has a higher version than referenced assembly 'Moq, Version=4.1.1309.1617, Culture=neutral, PublicKeyToken=69f491c39445e920'
      [csc] c:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests\Moq.dll: (Location of symbol related to previous error)

Is that the same error that you get?

The problem is the following:

Then I can build, except for SL-5.0, which I don't know how to solve yet. I need to talk to @remogloor regarding this, as I didn't have a deep look inside, yet.

Cheers, Phil

kevinkuszyk commented 10 years ago

Hi Phil,

Yes, I followed the instructions in HowToBuild.txt, but I'd forgotten about the tools folder (it's been a while since I looked at this!)

I just pushed an update, and all is building locally again except for the Silverlight version.

Kevin.

philippdolder commented 10 years ago

Hi Kevin,

ok, thanks. I try to talk to @remogloor asap on what we are still missing to make it work with SL 5 as well.

Phil

philippdolder commented 10 years ago

Hi Kevin,

I was finally able to talk to @remogloor about this issue. He reminded me of what I didn't recognize before. There is no need to update Moq or NSubstitute in the Ninject.MockingKernel.* packages.

The current prerelease of Ninject.MockingKernel.Moq already supports Moq 4.2 ([4.0, 5.0) to be precise). Unfortunately, IMO there is a flaw in Nuget which uses the smallest possible version of a dependency, instead of the newest possible version.

There is only a need to update the Moq, NSubstitute etc. dependencies when they change their interface.

To use Ninject.MockingKernel.Moq with the latest version of Moq perform the following steps in the Nuget Package Manager Console

install-package ninject.mockingkernel.moq -pre
update-package ninject.mockingkernel -pre
update-package ninject -pre
update-package moq

This will install and update to the latest prerelease versions of Ninject.MockingKernel.Moq and it's ninject dependencies as well as to the latest stable Moq version.

This should resolve your issue without the need to update Ninject.MockingKernel. If we would update the dependencies in the package, we would restrict the use to Moq version 4.2 or greater and therefore force all users of previous 4.* version to upgrade.

kevinkuszyk commented 10 years ago

Thanks Phil. I'd noticed the the pre-release packages had their dependency requirements relaxed. Can we get stable build released to nuget? Whilst I'm ok using pre-release packages in test projects, not everyone can / will.

I'll close this PR, and open a new issue for publishing a new stable version to Nuget.