Changed the NextVersion function after bug found.
Written tests for MatchesDependencies and NextVersion.

Still to finish writing tests for search (last thing to do).