diff --git a/Invoke-Tests.ps1 b/Invoke-Tests.ps1
index 3704d78a16..968a36f401 100644
--- a/Invoke-Tests.ps1
+++ b/Invoke-Tests.ps1
@@ -103,6 +103,7 @@ try {
if (-not $env:VM_RUNNING -and -not $env:TEST_KITCHEN) {
'VMOnly'
}
+ 'NaOHBroken'
)
}
}
diff --git a/build.ps1 b/build.ps1
index 674e6d1868..97728a54f5 100644
--- a/build.ps1
+++ b/build.ps1
@@ -50,6 +50,9 @@ Param(
[string[]]$ScriptArgs
)
+#REMOVE ME, TEMP SET EXTRA nuget source:
+$ENV:NUGETDEVRESTORE_SOURCE = "https://nuget.naoh.host/repository/nuget-public/index.json"
+
# Attempt to set highest encryption available for SecurityProtocol.
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
# will typically produce a message for PowerShell v2 (just an info
diff --git a/build.sh b/build.sh
index dfdc92e93e..343211814c 100755
--- a/build.sh
+++ b/build.sh
@@ -23,6 +23,9 @@ export CAKE_PATHS_TOOLS=$TOOLS_DIR
export CAKE_PATHS_ADDINS=$ADDINS_DIR
export CAKE_PATHS_MODULES=$MODULES_DIR
+#REMOVE ME, TEMP SET EXTRA nuget source:
+export NUGETDEVRESTORE_SOURCE="https://nuget.naoh.host/repository/nuget-public/index.json"
+
# Define md5sum or md5 depending on Linux / macOS
MD5_EXE=
if [[ "$(uname -s)" == "Darwin" ]]; then
diff --git a/src/chocolatey.console/chocolatey.console.csproj b/src/chocolatey.console/chocolatey.console.csproj
index 247276ade9..a1d575ee1d 100644
--- a/src/chocolatey.console/chocolatey.console.csproj
+++ b/src/chocolatey.console/chocolatey.console.csproj
@@ -154,8 +154,8 @@
..\packages\log4net.2.0.12\lib\net45\log4net.dll
-
- ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll
+
+ ..\packages\Microsoft.Web.Xdt.3.1.0\lib\net40\Microsoft.Web.XmlTransform.dll
..\packages\SimpleInjector.2.8.3\lib\net45\SimpleInjector.dll
diff --git a/src/chocolatey.console/packages.config b/src/chocolatey.console/packages.config
index 84c493cc67..be3de666cc 100644
--- a/src/chocolatey.console/packages.config
+++ b/src/chocolatey.console/packages.config
@@ -2,6 +2,6 @@
-
+
\ No newline at end of file
diff --git a/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj b/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj
index 64edb0d117..6098d8c944 100644
--- a/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj
+++ b/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj
@@ -72,8 +72,8 @@
..\packages\log4net.2.0.12\lib\net45\log4net.dll
-
- ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll
+
+ ..\packages\Microsoft.Web.Xdt.3.1.0\lib\net40\Microsoft.Web.XmlTransform.dll
..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll
@@ -81,6 +81,27 @@
..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\Chocolatey.NuGet.Common.6.4.1-zlocal.1\lib\net472\NuGet.Common.dll
+
+
+ ..\packages\Chocolatey.NuGet.Configuration.6.4.1-zlocal.1\lib\net472\NuGet.Configuration.dll
+
+
+ ..\packages\NuGet.Frameworks.6.4.1-zlocal.1\lib\net472\NuGet.Frameworks.dll
+
+
+ ..\packages\Chocolatey.NuGet.Packaging.6.4.1-zlocal.1\lib\net472\NuGet.Packaging.dll
+
+
+ ..\packages\Chocolatey.NuGet.Protocol.6.4.1-zlocal.1\lib\net472\NuGet.Protocol.dll
+
+
+ ..\packages\Chocolatey.NuGet.Versioning.6.4.1-zlocal.1\lib\net472\NuGet.Versioning.dll
+
..\packages\Should.1.1.20\lib\Should.dll
@@ -90,6 +111,10 @@
+
+
+
+
..\packages\Rx-Core.2.1.30214.0\lib\Net40\System.Reactive.Core.dll
@@ -99,6 +124,8 @@
..\packages\Rx-Linq.2.1.30214.0\lib\Net40\System.Reactive.Linq.dll
+
+
diff --git a/src/chocolatey.tests.integration/packages.config b/src/chocolatey.tests.integration/packages.config
index 9c0e7e0c0a..380783dd53 100644
--- a/src/chocolatey.tests.integration/packages.config
+++ b/src/chocolatey.tests.integration/packages.config
@@ -1,10 +1,17 @@
+
+
+
+
+
-
+
+
+
diff --git a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
index f91faa28ba..e510b937cc 100644
--- a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
+++ b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
@@ -26,6 +26,8 @@ namespace chocolatey.tests.integration.scenarios
using chocolatey.infrastructure.app.services;
using chocolatey.infrastructure.commands;
using chocolatey.infrastructure.results;
+ using NuGet.Configuration;
+ using NuGet.Packaging;
using NUnit.Framework;
using Should;
using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem;
@@ -45,8 +47,8 @@ public override void Context()
Configuration = Scenario.install();
Scenario.reset(Configuration);
Configuration.PackageNames = Configuration.Input = "installpackage";
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "badpackage.1*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "badpackage.1*" + NuGetConstants.PackageExtension);
Service = NUnitSetup.Container.GetInstance();
@@ -176,9 +178,11 @@ public void should_install_the_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -345,10 +349,10 @@ public override void Context()
base.Context();
var packagesConfig = "{0}{1}context{1}testing.packages.config".format_with(Scenario.get_top_level(), Path.DirectorySeparatorChar);
Configuration.PackageNames = Configuration.Input = packagesConfig;
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "upgradepackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "upgradepackage*" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -508,9 +512,11 @@ public void should_still_have_a_package_in_the_lib_directory()
[Fact]
public void should_still_have_the_expected_version_of_the_package_installed()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -591,9 +597,11 @@ public void should_install_the_package_in_the_lib_directory()
[Fact]
public void should_install_the_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -683,9 +691,11 @@ public override void Because()
[Fact]
public void should_restore_the_backup_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -780,9 +790,11 @@ public void should_reinstall_the_package_in_the_lib_directory()
[Fact]
public void should_reinstall_the_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -877,13 +889,14 @@ public void should_have_a_package_installed_in_the_lib_directory()
[Fact]
public void should_still_have_the_package_installed_with_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
- [Pending("Force install with file locked leaves inconsistent state - GH-114")]
public void should_delete_the_rollback()
{
var packageDir = Path.Combine(Scenario.get_top_level(), "lib-bkp", Configuration.PackageNames);
@@ -904,7 +917,6 @@ public void should_contain_a_message_that_it_was_unable_to_reinstall_successfull
}
[Fact]
- [Pending("Force install with file locked leaves inconsistent state - GH-114")]
public void should_not_have_a_successful_package_result()
{
packageResult.Success.ShouldBeFalse();
@@ -917,7 +929,6 @@ public void should_have_inconclusive_package_result()
}
[Fact]
- [Pending("Force install with file locked leaves inconsistent state - GH-114")]
public void should_not_have_warning_package_result()
{
packageResult.Warning.ShouldBeFalse();
@@ -1205,7 +1216,7 @@ public override void Context()
Configuration.PackageNames = Configuration.Input = "nonterminatingerror";
Configuration.Features.FailOnStandardError = false; //the default
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -1231,9 +1242,11 @@ public void should_install_the_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.Input, Configuration.Input + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.Input, Configuration.Input + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1273,9 +1286,9 @@ public void config_should_match_package_result_name()
}
[Fact]
- public void should_have_a_version_of_one_dot_zero()
+ public void should_have_a_version_of_one_dot_zero_dot_zero()
{
- packageResult.Version.ShouldEqual("1.0");
+ packageResult.Version.ShouldEqual("1.0.0");
}
}
@@ -1291,7 +1304,7 @@ public override void Context()
Configuration.PackageNames = Configuration.Input = "nonterminatingerror";
Configuration.Features.FailOnStandardError = true;
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -1407,6 +1420,50 @@ public void should_install_a_package_in_the_lib_directory()
DirectoryAssert.Exists(packageDir);
}
+ [Fact]
+ public void should_put_version_in_nupkg_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + ".1.0.0" + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_put_version_in_nuspec_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + ".1.0.0" + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_not_have_nupkg_without_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
+ [Fact]
+ public void should_not_have_nuspec_without_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
[Fact]
public void should_contain_a_warning_message_that_it_installed_successfully()
{
@@ -1498,6 +1555,50 @@ public void should_install_a_package_in_the_lib_directory()
DirectoryAssert.Exists(packageDir);
}
+ [Fact]
+ public void should_put_version_in_nupkg_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + ".1.0.0" + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_put_version_in_nuspec_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + ".1.0.0" + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_not_have_nupkg_without_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
+ [Fact]
+ public void should_not_have_nuspec_without_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.0.0"),
+ (Configuration.PackageNames + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
[Fact]
public void should_contain_a_warning_message_that_it_installed_successfully()
{
@@ -1541,6 +1642,128 @@ public void should_have_a_version_of_one_dot_zero_dot_zero()
}
}
+ public class when_installing_an_older_version_side_by_side_with_a_newer_version : ScenariosBase
+ {
+ private PackageResult packageResult;
+
+ public override void Context()
+ {
+ base.Context();
+ Configuration.PackageNames = Configuration.Input = "isdependency";
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
+ Scenario.install_package(Configuration, "isdependency", "2.0.0");
+ Configuration.AllowMultipleVersions = true;
+ Configuration.Version = "1.1.0";
+ }
+
+ public override void Because()
+ {
+ Results = Service.install_run(Configuration);
+ packageResult = Results.FirstOrDefault().Value;
+ }
+
+ [Fact]
+ public void should_install_where_install_location_reports()
+ {
+ Directory.Exists(packageResult.InstallLocation).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_install_a_package_in_the_lib_directory()
+ {
+ var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames) + ".1.1.0";
+
+ Directory.Exists(packageDir).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_put_version_in_nupkg_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.1.0"),
+ (Configuration.PackageNames + ".1.1.0" + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_put_version_in_nuspec_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.1.0"),
+ (Configuration.PackageNames + ".1.1.0" + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_not_have_nupkg_without_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.1.0"),
+ (Configuration.PackageNames + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
+ [Fact]
+ public void should_not_have_nuspec_without_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ (Configuration.PackageNames + ".1.1.0"),
+ (Configuration.PackageNames + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
+ [Fact]
+ public void should_contain_a_warning_message_that_it_installed_successfully()
+ {
+ bool installedSuccessfully = false;
+ foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null())
+ {
+ if (message.Contains("1/1")) installedSuccessfully = true;
+ }
+
+ installedSuccessfully.ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_have_a_successful_package_result()
+ {
+ packageResult.Success.ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_not_have_inconclusive_package_result()
+ {
+ packageResult.Inconclusive.ShouldBeFalse();
+ }
+
+ [Fact]
+ public void should_not_have_warning_package_result()
+ {
+ packageResult.Warning.ShouldBeFalse();
+ }
+
+ [Fact]
+ public void config_should_match_package_result_name()
+ {
+ packageResult.Name.ShouldEqual(Configuration.PackageNames);
+ }
+
+ [Fact]
+ public void should_have_a_version_of_one_dot_one_dot_zero()
+ {
+ packageResult.Version.ShouldEqual("1.1.0");
+ }
+ }
+
+
public class when_switching_a_side_by_side_package_to_a_normal_package : ScenariosBase
{
private PackageResult packageResult;
@@ -1574,6 +1797,58 @@ public void should_install_a_package_in_the_lib_directory()
DirectoryAssert.Exists(packageDir);
}
+ [Fact]
+ public void should_remove_version_directory_in_the_lib_directory()
+ {
+ var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames + ".1.0.0");
+
+ Directory.Exists(packageDir).ShouldBeFalse();
+ }
+
+ [Fact]
+ public void should_not_put_version_in_nupkg_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ Configuration.PackageNames,
+ (Configuration.PackageNames + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_not_put_version_in_nuspec_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ Configuration.PackageNames,
+ (Configuration.PackageNames + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeTrue();
+ }
+
+ [Fact]
+ public void should_not_have_nupkg_with_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ Configuration.PackageNames,
+ (Configuration.PackageNames + ".1.0.0" + NuGetConstants.PackageExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
+ [Fact]
+ public void should_not_have_nuspec_with_version_in_filename()
+ {
+ var packageFile = Path.Combine(
+ Scenario.get_top_level(), "lib",
+ Configuration.PackageNames,
+ (Configuration.PackageNames + ".1.0.0" + NuGetConstants.ManifestExtension));
+
+ File.Exists(packageFile).ShouldBeFalse();
+ }
+
[Fact]
public void should_contain_a_warning_message_that_it_installed_successfully()
{
@@ -1623,9 +1898,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -1662,8 +1937,10 @@ public void should_install_the_dependency_in_the_lib_directory()
public void should_install_the_expected_version_of_the_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1722,11 +1999,11 @@ public override void Context()
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
- Scenario.add_packages_to_source_location(Configuration, "isdependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency*" + NuGetConstants.PackageExtension);
Configuration.Force = true;
}
@@ -1755,9 +2032,11 @@ public void should_install_a_package_in_the_lib_directory()
[Fact]
public void should_reinstall_the_exact_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1772,8 +2051,10 @@ public void should_still_have_the_dependency_in_the_lib_directory()
public void should_not_upgrade_the_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1832,11 +2113,11 @@ public override void Context()
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
- Scenario.add_packages_to_source_location(Configuration, "isdependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency*" + NuGetConstants.PackageExtension);
Configuration.Force = true;
Configuration.ForceDependencies = true;
}
@@ -1866,9 +2147,11 @@ public void should_install_a_package_in_the_lib_directory()
[Fact]
public void should_reinstall_the_exact_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1883,16 +2166,20 @@ public void should_install_the_dependency_in_the_lib_directory()
public void should_reinstall_the_floating_dependency_with_the_latest_version_that_satisfies_the_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
public void should_reinstall_the_exact_same_version_of_the_exact_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1942,11 +2229,11 @@ public override void Context()
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
- Scenario.add_packages_to_source_location(Configuration, "isdependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency*" + NuGetConstants.PackageExtension);
Configuration.Force = true;
Configuration.IgnoreDependencies = true;
}
@@ -1976,9 +2263,11 @@ public void should_install_a_package_in_the_lib_directory()
[Fact]
public void should_reinstall_the_exact_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1993,16 +2282,20 @@ public void should_install_the_dependency_in_the_lib_directory()
public void should_not_touch_the_floating_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
public void should_not_touch_the_exact_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2052,11 +2345,11 @@ public override void Context()
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
- Scenario.add_packages_to_source_location(Configuration, "isdependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency*" + NuGetConstants.PackageExtension);
Configuration.Force = true;
Configuration.ForceDependencies = true;
Configuration.IgnoreDependencies = true;
@@ -2087,9 +2380,11 @@ public void should_install_a_package_in_the_lib_directory()
[Fact]
public void should_reinstall_the_exact_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2152,7 +2447,7 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency*" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -2262,7 +2557,7 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency*" + NuGetConstants.PackageExtension);
Configuration.IgnoreDependencies = true;
}
@@ -2289,9 +2584,11 @@ public void should_install_a_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
@@ -2345,10 +2642,10 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.1.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.1.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
}
@@ -2377,9 +2674,11 @@ public void should_install_a_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.6.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.6.0.0");
+ }
}
[Fact]
@@ -2394,8 +2693,10 @@ public void should_install_the_dependency_in_the_lib_directory()
public void should_upgrade_the_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -2444,9 +2745,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
}
@@ -2509,9 +2810,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Configuration.IgnoreDependencies = true;
}
@@ -2541,9 +2842,11 @@ public void should_install_a_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.6.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.6.0.0");
+ }
}
[Fact]
@@ -2592,9 +2895,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.6.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Configuration.Force = true;
Configuration.ForceDependencies = true;
@@ -2617,8 +2920,10 @@ public void should_not_install_a_package_in_the_lib_directory()
public void should_not_upgrade_the_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2705,10 +3010,10 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "conflictingdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "conflictingdependency.1.0.1*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "conflictingdependency.1.0.1*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
}
@@ -2739,8 +3044,10 @@ public void should_install_a_package_in_the_lib_directory()
public void should_upgrade_the_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.1.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.1.0");
+ }
}
[Fact]
@@ -2789,10 +3096,10 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "conflictingdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "conflictingdependency.2.1.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "conflictingdependency.2.1.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
}
@@ -2803,17 +3110,15 @@ public override void Because()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_install_the_conflicting_package()
{
foreach (var packageResult in Results)
{
- DirectoryAssert.Exists(packageResult.Value.InstallLocation);
+ Directory.Exists(packageResult.Value.InstallLocation).ShouldBeFalse();
}
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_install_the_conflicting_package_in_the_lib_directory()
{
var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames);
@@ -2822,38 +3127,38 @@ public void should_not_install_the_conflicting_package_in_the_lib_directory()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_upgrade_the_minimum_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_contain_a_message_that_it_was_unable_to_install_any_packages()
{
bool expectedMessage = false;
foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null())
{
- if (message.Contains("installed 0/3")) expectedMessage = true;
+ if (message.Contains("installed 0/")) expectedMessage = true;
}
expectedMessage.ShouldBeTrue();
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_have_a_successful_package_result()
{
foreach (var packageResult in Results)
@@ -2863,7 +3168,6 @@ public void should_not_have_a_successful_package_result()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_have_inconclusive_package_result()
{
foreach (var packageResult in Results)
@@ -2873,7 +3177,6 @@ public void should_not_have_inconclusive_package_result()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_have_warning_package_result()
{
foreach (var packageResult in Results)
@@ -2883,7 +3186,6 @@ public void should_not_have_warning_package_result()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_have_an_error_package_result()
{
bool errorFound = false;
@@ -2909,10 +3211,10 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "conflictingdependency.2.1.0*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "conflictingdependency.2.1.0*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "conflictingdependency", "2.1.0");
}
@@ -2929,7 +3231,6 @@ public override void Because()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_install_the_conflicting_package_in_the_lib_directory()
{
var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames);
@@ -2938,29 +3239,28 @@ public void should_not_install_the_conflicting_package_in_the_lib_directory()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
- public void should_not_upgrade_the_exact_version_dependency()
+ public void should_not_downgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.0.0.0");
+ }
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_contain_a_message_that_it_was_unable_to_install_any_packages()
{
bool expectedMessage = false;
foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null())
{
- if (message.Contains("installed 0/3")) expectedMessage = true;
+ if (message.Contains("installed 0/")) expectedMessage = true;
}
expectedMessage.ShouldBeTrue();
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_have_a_successful_package_result()
{
foreach (var packageResult in Results)
@@ -2970,7 +3270,6 @@ public void should_not_have_a_successful_package_result()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_have_inconclusive_package_result()
{
foreach (var packageResult in Results)
@@ -2980,7 +3279,6 @@ public void should_not_have_inconclusive_package_result()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_not_have_warning_package_result()
{
foreach (var packageResult in Results)
@@ -2990,7 +3288,6 @@ public void should_not_have_warning_package_result()
}
[Fact]
- [Pending("NuGet does not deal with version conflicts - GH-116")]
public void should_have_an_error_package_result()
{
bool errorFound = false;
@@ -3016,9 +3313,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "toplevelhasexactversiondependency";
- Scenario.add_packages_to_source_location(Configuration, "toplevelhasexactversiondependency*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "childdependencywithlooserversiondependency*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "toplevelhasexactversiondependency*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "childdependencywithlooserversiondependency*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -3034,7 +3331,6 @@ public override void Because()
*/
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_install_where_install_location_reports()
{
foreach (var packageResult in Results)
@@ -3044,7 +3340,6 @@ public void should_install_where_install_location_reports()
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_install_a_package_in_the_lib_directory()
{
var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames);
@@ -3053,7 +3348,6 @@ public void should_install_a_package_in_the_lib_directory()
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_install_the_dependency_in_the_lib_directory()
{
var packageDir = Path.Combine(Scenario.get_top_level(), "lib", "childdependencywithlooserversiondependency");
@@ -3062,25 +3356,26 @@ public void should_install_the_dependency_in_the_lib_directory()
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_install_the_expected_version_of_the_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "childdependencywithlooserversiondependency", "childdependencywithlooserversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_install_the_expected_version_of_the_constrained_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_contain_a_message_that_everything_installed_successfully()
{
bool expectedMessage = false;
@@ -3093,7 +3388,6 @@ public void should_contain_a_message_that_everything_installed_successfully()
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_have_a_successful_package_result()
{
foreach (var packageResult in Results)
@@ -3103,7 +3397,6 @@ public void should_have_a_successful_package_result()
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_not_have_inconclusive_package_result()
{
foreach (var packageResult in Results)
@@ -3113,7 +3406,6 @@ public void should_not_have_inconclusive_package_result()
}
[Fact]
- [Pending("NuGet does not handle version conflicts with highestversion dependency resolution - GH-507")]
public void should_not_have_warning_package_result()
{
foreach (var packageResult in Results)
@@ -3156,9 +3448,11 @@ public void should_install_the_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "installpackage", "installpackage" + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "installpackage", "installpackage" + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -3320,7 +3614,7 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "upgradepackage";
- Scenario.add_packages_to_source_location(Configuration, "upgradepackage.1.0.0*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "upgradepackage.1.0.0*" + NuGetConstants.PackageExtension);
_xmlFilePath = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "console.exe.config");
}
@@ -3336,9 +3630,11 @@ public override void Because()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -3428,7 +3724,7 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "scriptpackage.hook";
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".1.0.0" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".1.0.0" + NuGetConstants.PackageExtension);
}
private PackageResult _packageResult;
@@ -3450,9 +3746,11 @@ public void should_install_the_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -3533,7 +3831,7 @@ public class when_installing_a_package_happy_path_with_hook_scripts : ScenariosB
public override void Context()
{
base.Context();
- Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0");
Configuration.PackageNames = Configuration.Input = "installpackage";
}
@@ -3561,9 +3859,11 @@ public void should_install_the_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -3786,10 +4086,10 @@ public class when_installing_a_portable_package_happy_path_with_hook_scripts : S
public override void Context()
{
base.Context();
- Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + ".1.0.0" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + ".1.0.0" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0");
Configuration.PackageNames = Configuration.Input = "portablepackage";
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -3815,9 +4115,11 @@ public void should_install_the_package_in_the_lib_directory()
[Fact]
public void should_install_the_expected_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
diff --git a/src/chocolatey.tests.integration/scenarios/ListScenarios.cs b/src/chocolatey.tests.integration/scenarios/ListScenarios.cs
index fa7850e617..6bdc38c039 100644
--- a/src/chocolatey.tests.integration/scenarios/ListScenarios.cs
+++ b/src/chocolatey.tests.integration/scenarios/ListScenarios.cs
@@ -23,6 +23,7 @@ namespace chocolatey.tests.integration.scenarios
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.app.services;
using chocolatey.infrastructure.results;
+ using NuGet.Configuration;
using NUnit.Framework;
using Should;
@@ -39,8 +40,8 @@ public override void Context()
{
Configuration = Scenario.list();
Scenario.reset(Configuration);
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "installpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "installpackage*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "installpackage", "1.0.0");
Scenario.install_package(Configuration, "upgradepackage", "1.0.0");
@@ -437,7 +438,7 @@ public override void Context()
{
Configuration = Scenario.list();
Scenario.reset(Configuration);
- Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + NuGetConstants.PackageExtension);
Service = NUnitSetup.Container.GetInstance();
Configuration.ListCommand.Exact = true;
@@ -496,7 +497,7 @@ public override void Context()
{
Configuration = Scenario.list();
Scenario.reset(Configuration);
- Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + NuGetConstants.PackageExtension);
Service = NUnitSetup.Container.GetInstance();
Configuration.ListCommand.Exact = true;
@@ -551,7 +552,7 @@ public override void Context()
{
Configuration = Scenario.list();
Scenario.reset(Configuration);
- Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + NuGetConstants.PackageExtension);
Service = NUnitSetup.Container.GetInstance();
Configuration.ListCommand.Exact = true;
@@ -580,15 +581,15 @@ public void should_find_two_results()
[Fact]
public void should_find_only_packages_with_exact_id()
{
- Results[0].Package.Id.ShouldEqual("exactpackage");
- Results[1].Package.Id.ShouldEqual("exactpackage");
+ Results[0].PackageMetadata.Id.ShouldEqual("exactpackage");
+ Results[1].PackageMetadata.Id.ShouldEqual("exactpackage");
}
[Fact]
public void should_find_all_non_prerelease_versions_in_descending_order()
{
- Results[0].Package.Version.ToNormalizedString().ShouldEqual("1.0.0");
- Results[1].Package.Version.ToNormalizedString().ShouldEqual("0.9.0");
+ Results[0].PackageMetadata.Version.ToNormalizedString().ShouldEqual("1.0.0");
+ Results[1].PackageMetadata.Version.ToNormalizedString().ShouldEqual("0.9.0");
}
}
@@ -598,7 +599,7 @@ public override void Context()
{
Configuration = Scenario.list();
Scenario.reset(Configuration);
- Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + NuGetConstants.PackageExtension);
Service = NUnitSetup.Container.GetInstance();
Configuration.ListCommand.Exact = true;
@@ -628,17 +629,17 @@ public void should_find_three_results()
[Fact]
public void should_find_only_packages_with_exact_id()
{
- Results[0].Package.Id.ShouldEqual("exactpackage");
- Results[1].Package.Id.ShouldEqual("exactpackage");
- Results[2].Package.Id.ShouldEqual("exactpackage");
+ Results[0].PackageMetadata.Id.ShouldEqual("exactpackage");
+ Results[1].PackageMetadata.Id.ShouldEqual("exactpackage");
+ Results[2].PackageMetadata.Id.ShouldEqual("exactpackage");
}
[Fact]
public void should_find_all_versions_in_descending_order()
{
- Results[0].Package.Version.ToNormalizedString().ShouldEqual("1.0.0");
- Results[1].Package.Version.ToNormalizedString().ShouldEqual("1.0.0-beta1");
- Results[2].Package.Version.ToNormalizedString().ShouldEqual("0.9.0");
+ Results[0].PackageMetadata.Version.ToNormalizedString().ShouldEqual("1.0.0");
+ Results[1].PackageMetadata.Version.ToNormalizedString().ShouldEqual("1.0.0-beta1");
+ Results[2].PackageMetadata.Version.ToNormalizedString().ShouldEqual("0.9.0");
}
}
}
diff --git a/src/chocolatey.tests.integration/scenarios/PinScenarios.cs b/src/chocolatey.tests.integration/scenarios/PinScenarios.cs
index 3758028bbb..7c17f7a6f6 100644
--- a/src/chocolatey.tests.integration/scenarios/PinScenarios.cs
+++ b/src/chocolatey.tests.integration/scenarios/PinScenarios.cs
@@ -29,6 +29,7 @@ namespace chocolatey.tests.integration.scenarios
using NUnit.Framework;
+ using NuGet.Configuration;
using Should;
public class PinScenarios
@@ -44,8 +45,8 @@ public override void Context()
{
Configuration = Scenario.pin();
Scenario.reset(Configuration);
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "installpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "installpackage*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "installpackage", "1.0.0");
Scenario.install_package(Configuration, "upgradepackage", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
diff --git a/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs
index ffc37548f6..17b3cf5d18 100644
--- a/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs
+++ b/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs
@@ -26,6 +26,7 @@ namespace chocolatey.tests.integration.scenarios
using chocolatey.infrastructure.commands;
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.results;
+ using NuGet.Configuration;
using NUnit.Framework;
using Should;
using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem;
@@ -45,9 +46,9 @@ public override void Context()
Configuration = Scenario.uninstall();
Scenario.reset(Configuration);
Configuration.PackageNames = Configuration.Input = "installpackage";
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "installpackage", "1.0.0");
- Scenario.add_packages_to_source_location(Configuration, "badpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "badpackage*" + NuGetConstants.PackageExtension);
Configuration.SkipPackageInstallProvider = true;
Scenario.install_package(Configuration, "badpackage", "1.0");
Configuration.SkipPackageInstallProvider = false;
@@ -989,7 +990,7 @@ public void should_not_remove_package_from_the_lib_directory()
[Fact]
public void should_still_have_the_package_file_in_the_directory()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
File.Exists(packageFile).ShouldBeTrue();
}
@@ -1079,7 +1080,7 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "scriptpackage.hook";
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".1.0.0" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".1.0.0" + NuGetConstants.PackageExtension);
Service.install_run(Configuration);
}
@@ -1157,7 +1158,7 @@ public class when_uninstalling_a_package_happy_path_with_hooks : ScenariosBase
public override void Context()
{
base.Context();
- Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0");
}
diff --git a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs
index 1b8da55e95..10e41abcff 100644
--- a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs
+++ b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs
@@ -28,6 +28,8 @@ namespace chocolatey.tests.integration.scenarios
using chocolatey.infrastructure.app.services;
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.results;
+ using NuGet.Configuration;
+ using NuGet.Packaging;
using NUnit.Framework;
using Should;
@@ -45,9 +47,9 @@ public override void Context()
Configuration = Scenario.upgrade();
Scenario.reset(Configuration);
Configuration.PackageNames = Configuration.Input = "upgradepackage";
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "installpackage*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "badpackage*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "installpackage*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "badpackage*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "installpackage", "1.0.0");
Scenario.install_package(Configuration, "upgradepackage", "1.0.0");
Configuration.SkipPackageInstallProvider = true;
@@ -241,9 +243,11 @@ public void should_contain_newer_version_in_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -399,9 +403,11 @@ public void should_not_remove_the_package_from_the_lib_directory()
[Fact]
public void should_be_the_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -478,10 +484,12 @@ public void should_contain_newer_version_in_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.1.0");
- package.Version.to_string().ShouldEqual("1.1.1-beta2");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.1.0");
+ packageReader.NuspecReader.GetVersion().OriginalVersion.to_string().ShouldEqual("1.1.1-beta2");
+ }
}
[Fact]
@@ -629,10 +637,12 @@ public void should_contain_newer_version_in_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.1.0");
- package.Version.to_string().ShouldEqual("1.1.1-beta2");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.1.0");
+ packageReader.NuspecReader.GetVersion().OriginalVersion.to_string().ShouldEqual("1.1.1-beta2");
+ }
}
[Fact]
@@ -791,9 +801,11 @@ public void should_not_remove_the_package_from_the_lib_directory()
[Fact]
public void should_be_the_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.1.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.1.0");
+ }
}
[Fact]
@@ -884,9 +896,11 @@ public void should_not_remove_the_package_from_the_lib_directory()
[Fact]
public void should_be_the_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.1.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.1.0");
+ }
}
[Fact]
@@ -947,9 +961,11 @@ public void should_upgrade_a_package_in_the_lib_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -1082,9 +1098,11 @@ public void should_not_remove_the_package_from_the_lib_directory()
[Fact]
public void should_be_the_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1172,9 +1190,11 @@ public void should_not_remove_the_package_from_the_lib_directory()
[Fact]
public void should_be_the_same_version_of_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1261,9 +1281,11 @@ public void should_upgrade_a_package_in_the_lib_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -1370,9 +1392,11 @@ public void should_upgrade_a_package_in_the_lib_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -1490,9 +1514,11 @@ public void should_contain_old_version_in_directory()
[Fact]
public void should_not_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1574,9 +1600,11 @@ public void should_contain_newer_version_in_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -1652,9 +1680,11 @@ public void should_contain_newer_version_in_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -1979,9 +2009,11 @@ public void should_not_remove_package_from_the_lib_directory()
[Fact]
public void should_not_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -1995,9 +2027,11 @@ public void should_put_the_package_in_the_lib_bad_directory()
[Fact]
public void should_have_the_erroring_upgraded_package_in_the_lib_bad_directory()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib-bad", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib-bad", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.0.0.0");
+ }
}
[Fact]
@@ -2075,9 +2109,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
}
@@ -2091,24 +2125,30 @@ public override void Because()
public void should_upgrade_the_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency", "hasdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
public void should_upgrade_the_minimum_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
public void should_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.0.0.0");
+ }
}
[Fact]
@@ -2157,9 +2197,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency.1*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency.1*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
}
@@ -2173,24 +2213,30 @@ public override void Because()
public void should_not_upgrade_the_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency", "hasdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
public void should_not_upgrade_the_minimum_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
public void should_not_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2277,9 +2323,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "hasdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency.1*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency.1*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
Configuration.IgnoreDependencies = true;
@@ -2294,24 +2340,30 @@ public override void Because()
public void should_upgrade_the_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency", "hasdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
public void should_not_upgrade_the_minimum_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
public void should_not_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2360,9 +2412,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "isdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
}
@@ -2376,24 +2428,30 @@ public override void Because()
public void should_upgrade_the_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
public void should_not_upgrade_the_parent_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency", "hasdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
public void should_not_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2442,9 +2500,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "isdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.1*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.1*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Configuration.AllowMultipleVersions = true;
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
@@ -2474,8 +2532,10 @@ public override void Because()
public void should_upgrade_the_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -2496,8 +2556,10 @@ public void should_replace_the_legacy_folder_version_of_the_package_with_a_lib_p
public void should_not_upgrade_the_parent_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency.1.0.0", "hasdependency.1.0.0.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2518,8 +2580,10 @@ public void should_leave_the_parent_package_as_legacy_folder()
public void should_not_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency.1.0.0", "isexactversiondependency.1.0.0.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.0.0.0");
+ }
}
[Fact]
@@ -2582,9 +2646,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "isdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
}
@@ -2598,24 +2662,30 @@ public override void Because()
public void should_upgrade_the_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
- public void should_upgrade_the_parent_package_to_lowest_version_that_meets_new_dependency_version()
+ public void should_upgrade_the_parent_package_to_highest_version_that_meets_new_dependency_version()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency", "hasdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.1.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
public void should_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.1.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.0.0.0");
+ }
}
[Fact]
@@ -2664,9 +2734,9 @@ public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "isdependency";
- Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + Constants.PackageExtension);
- Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "hasdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isdependency.*" + NuGetConstants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Configuration.AllowMultipleVersions = true;
Scenario.install_package(Configuration, "isdependency", "1.0.0");
Scenario.install_package(Configuration, "hasdependency", "1.0.0");
@@ -2688,8 +2758,10 @@ public override void Because()
public void should_upgrade_the_package()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isdependency", "isdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.1.0.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
@@ -2707,11 +2779,13 @@ public void should_replace_the_legacy_folder_version_of_the_package_with_a_lib_p
}
[Fact]
- public void should_upgrade_the_parent_package_to_lowest_version_that_meets_new_dependency_version()
+ public void should_upgrade_the_parent_package_to_highest_version_that_meets_new_dependency_version()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency", "hasdependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.1.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.1.0.0");
+ }
}
[Fact]
@@ -2722,7 +2796,7 @@ public void should_replace_the_legacy_folder_version_of_the_parent_package_with_
}
[Fact]
- [Pending("Legacy packages are left when implicit - GH-117")]
+ //[Pending("Legacy packages are left when implicit - GH-117")]
public void should_remove_the_legacy_folder_version_of_the_parent_package()
{
var packageDir = Path.Combine(Scenario.get_top_level(), "lib", "hasdependency.1.0.0");
@@ -2733,8 +2807,10 @@ public void should_remove_the_legacy_folder_version_of_the_parent_package()
public void should_upgrade_the_exact_version_dependency()
{
var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency", "isexactversiondependency.nupkg");
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.0.1.0");
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.0.0.0");
+ }
}
[Fact]
@@ -2745,7 +2821,7 @@ public void should_replace_the_legacy_folder_version_of_the_exact_version_packag
}
[Fact]
- [Pending("Legacy packages are left when implicit - GH-117")]
+ //[Pending("Legacy packages are left when implicit - GH-117")]
public void should_remove_the_legacy_folder_version_of_the_exact_version_package()
{
var packageDir = Path.Combine(Scenario.get_top_level(), "lib", "isexactversiondependency.1.0.0");
@@ -2817,9 +2893,11 @@ public override void Because()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -2915,9 +2993,11 @@ public override void Because()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
@@ -3086,9 +3166,11 @@ public void should_upgrade_packages_with_upgrades()
[Fact]
public void should_upgrade_upgradepackage()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "upgradepackage", "upgradepackage" + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.to_string().ShouldEqual("1.1.1-beta2");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "upgradepackage", "upgradepackage" + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().OriginalVersion.ShouldEqual("1.1.1-beta2");
+ }
}
[Fact]
@@ -3136,9 +3218,11 @@ public void should_upgrade_packages_with_upgrades()
[Fact]
public void should_not_upgrade_upgradepackage()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "upgradepackage", "upgradepackage" + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.to_string().ShouldEqual("1.1.1-beta");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", "upgradepackage", "upgradepackage" + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().OriginalVersion.to_string().ShouldEqual("1.1.1-beta");
+ }
}
[Fact]
@@ -3186,10 +3270,10 @@ public class when_upgrading_an_existing_hook_package : ScenariosBase
public override void Context()
{
base.Context();
- Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + ".1.0.0" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + ".1.0.0" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0");
Configuration.PackageNames = Configuration.Input = "scriptpackage.hook";
- Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".2.0.0" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".2.0.0" + NuGetConstants.PackageExtension);
}
public override void Because()
@@ -3223,9 +3307,11 @@ public void should_delete_the_rollback()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("2.0.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("2.0.0.0");
+ }
}
[Fact]
@@ -3323,7 +3409,7 @@ public class when_upgrading_an_existing_package_happy_path_with_hooks : Scenario
public override void Context()
{
base.Context();
- Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + Constants.PackageExtension);
+ Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + NuGetConstants.PackageExtension);
Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0");
Configuration.PackageNames = Configuration.Input = "upgradepackage";
}
@@ -3367,9 +3453,11 @@ public void should_contain_newer_version_in_directory()
[Fact]
public void should_upgrade_the_package()
{
- var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension);
- var package = new OptimizedZipPackage(packageFile);
- package.Version.Version.to_string().ShouldEqual("1.1.0.0");
+ var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + NuGetConstants.PackageExtension);
+ using (var packageReader = new PackageArchiveReader(packageFile))
+ {
+ packageReader.NuspecReader.GetVersion().Version.to_string().ShouldEqual("1.1.0.0");
+ }
}
[Fact]
diff --git a/src/chocolatey.tests/TinySpec.cs b/src/chocolatey.tests/TinySpec.cs
index 6385838b4d..e290c4a5bc 100644
--- a/src/chocolatey.tests/TinySpec.cs
+++ b/src/chocolatey.tests/TinySpec.cs
@@ -63,13 +63,23 @@ public MockLogger MockLogger
get { return NUnitSetup.MockLogger; }
}
+ Exception testFixtureSetupException = null;
+
[OneTimeSetUp]
public void Setup()
{
- if (MockLogger != null) MockLogger.reset();
- //Log.InitializeWith(MockLogger);
- Context();
- Because();
+ try
+ {
+ if (MockLogger != null) MockLogger.reset();
+ //Log.InitializeWith(MockLogger);
+ Context();
+ Because();
+
+ }
+ catch (Exception ex)
+ {
+ testFixtureSetupException = ex;
+ }
}
public abstract void Context();
@@ -79,6 +89,13 @@ public void Setup()
[SetUp]
public void EachSpecSetup()
{
+ if (testFixtureSetupException != null)
+ {
+ string msg = string.Format("There was a failure during test fixture setup, resulting in a {1} exception. {0}Exception Message: {2}{0}Stack Trace:{3}",
+ Environment.NewLine, testFixtureSetupException.GetType(), testFixtureSetupException.Message, testFixtureSetupException.StackTrace);
+ Assert.Fail(msg);
+ }
+
BeforeEachSpec();
}
diff --git a/src/chocolatey.tests/chocolatey.tests.csproj b/src/chocolatey.tests/chocolatey.tests.csproj
index e92c90f5ee..5a549aae78 100644
--- a/src/chocolatey.tests/chocolatey.tests.csproj
+++ b/src/chocolatey.tests/chocolatey.tests.csproj
@@ -71,8 +71,8 @@
..\packages\log4net.2.0.12\lib\net45\log4net.dll
-
- ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll
+
+ ..\packages\Microsoft.Web.Xdt.3.1.0\lib\net40\Microsoft.Web.XmlTransform.dll
..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll
@@ -80,6 +80,27 @@
..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\Chocolatey.NuGet.Common.6.4.1-zlocal.1\lib\net472\NuGet.Common.dll
+
+
+ ..\packages\Chocolatey.NuGet.Configuration.6.4.1-zlocal.1\lib\net472\NuGet.Configuration.dll
+
+
+ ..\packages\NuGet.Frameworks.6.4.1-zlocal.1\lib\net472\NuGet.Frameworks.dll
+
+
+ ..\packages\Chocolatey.NuGet.Packaging.6.4.1-zlocal.1\lib\net472\NuGet.Packaging.dll
+
+
+ ..\packages\Chocolatey.NuGet.Protocol.6.4.1-zlocal.1\lib\net472\NuGet.Protocol.dll
+
+
+ ..\packages\Chocolatey.NuGet.Versioning.6.4.1-zlocal.1\lib\net472\NuGet.Versioning.dll
+
..\packages\Should.1.1.20\lib\Should.dll
@@ -89,6 +110,12 @@
+
+
+
+
+
+
diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs
index f57e7a71b9..41c47cf571 100644
--- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs
+++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs
@@ -28,6 +28,9 @@ namespace chocolatey.tests.infrastructure.app.commands
using chocolatey.infrastructure.commandline;
using chocolatey.infrastructure.results;
using Moq;
+ using NuGet.Common;
+ using NuGet.Packaging;
+ using NuGet.Versioning;
using Should;
public class ChocolateyPinCommandSpecs
@@ -40,27 +43,27 @@ public abstract class ChocolateyPinCommandSpecsBase : TinySpec
protected Mock nugetLogger = new Mock();
protected Mock nugetService = new Mock();
protected ChocolateyConfiguration configuration = new ChocolateyConfiguration();
- protected Mock package = new Mock();
- protected Mock pinnedPackage = new Mock();
+ protected Mock package = new Mock();
+ protected Mock pinnedPackage = new Mock();
public override void Context()
{
- // MockLogger = new MockLogger();
- // Log.InitializeWith(MockLogger);
+ //MockLogger = new MockLogger();
+ //Log.InitializeWith(MockLogger);
configuration.Sources = "https://localhost/somewhere/out/there";
command = new ChocolateyPinCommand(packageInfoService.Object, nugetLogger.Object, nugetService.Object);
- package = new Mock();
+ package = new Mock();
package.Setup(p => p.Id).Returns("regular");
- package.Setup(p => p.Version).Returns(new SemanticVersion("1.2.0"));
+ package.Setup(p => p.Version).Returns(new NuGetVersion("1.2.0"));
packageInfoService.Setup(s => s.get_package_information(package.Object)).Returns(
new ChocolateyPackageInformation(package.Object)
{
IsPinned = false
});
- pinnedPackage = new Mock();
+ pinnedPackage = new Mock();
pinnedPackage.Setup(p => p.Id).Returns("pinned");
- pinnedPackage.Setup(p => p.Version).Returns(new SemanticVersion("1.1.0"));
+ pinnedPackage.Setup(p => p.Version).Returns(new NuGetVersion("1.1.0"));
packageInfoService.Setup(s => s.get_package_information(pinnedPackage.Object)).Returns(
new ChocolateyPackageInformation(pinnedPackage.Object)
{
@@ -329,7 +332,7 @@ public void should_log_a_message()
[Fact]
public void should_log_the_message_we_expect()
{
- var messages = MockLogger.MessagesFor(LogLevel.Info);
+ var messages = MockLogger.MessagesFor(tests.LogLevel.Info);
messages.ShouldNotBeEmpty();
messages.Count.ShouldEqual(1);
messages[0].ShouldContain("Pin would have called");
@@ -386,8 +389,6 @@ public void should_log_one_message()
public class when_run_is_called : ChocolateyPinCommandSpecsBase
{
//private Action because;
- private readonly Mock packageManager = new Mock();
- private readonly Mock localRepository = new Mock();
public override void Context()
{
@@ -431,13 +432,13 @@ public void should_set_pin_when_command_is_add()
reset();
configuration.PinCommand.Name = "regular";
- packageManager.Setup(pm => pm.LocalRepository).Returns(localRepository.Object);
- SemanticVersion semanticVersion = null;
+ //packageManager.Setup(pm => pm.LocalRepository).Returns(localRepository.Object);
+ NuGetVersion nugetVersion = null;
//nuget woes
- localRepository.Setup(r => r.FindPackage(configuration.PinCommand.Name, semanticVersion)).Returns(package.Object);
+ //localRepository.Setup(r => r.FindPackage(configuration.PinCommand.Name, nugetVersion)).Returns(package.Object);
configuration.PinCommand.Command = PinCommandType.add;
- command.set_pin(packageManager.Object, configuration);
+ //command.set_pin(packageManager.Object, configuration);
packageInfoService.Verify(s => s.save_package_information(It.IsAny()), Times.Once);
}
@@ -448,13 +449,14 @@ public void should_remove_pin_when_command_is_remove()
{
reset();
configuration.PinCommand.Name = "pinned";
- packageManager.Setup(pm => pm.LocalRepository).Returns(localRepository.Object);
+ // packageManager.Setup(pm => pm.LocalRepository).Returns(localRepository.Object);
configuration.PinCommand.Command = PinCommandType.remove;
- command.set_pin(packageManager.Object, configuration);
+ //command.set_pin(packageManager.Object, configuration);
packageInfoService.Verify(s => s.save_package_information(It.IsAny()), Times.Once);
}
}
+
}
}
diff --git a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs
index d749d8ef39..2453b2c79c 100644
--- a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs
+++ b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs
@@ -17,10 +17,15 @@
namespace chocolatey.tests.infrastructure.app.nuget
{
using System;
+ using System.Collections.Generic;
using System.Linq;
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.app.nuget;
using Moq;
+ using NuGet.Common;
+ using NuGet.Packaging;
+ using NuGet.Protocol;
+ using NuGet.Protocol.Core.Types;
using Should;
public class NugetCommonSpecs
@@ -31,7 +36,7 @@ private class when_gets_remote_repository : TinySpec
private readonly Mock nugetLogger = new Mock();
private readonly Mock packageDownloader = new Mock();
private ChocolateyConfiguration configuration;
- private IPackageRepository packageRepository;
+ private IEnumerable packageRepositories;
public override void Context()
{
@@ -42,7 +47,7 @@ public override void Context()
public override void Because()
{
- because = () => packageRepository = NugetCommon.GetRemoteRepository(configuration, nugetLogger.Object, packageDownloader.Object);
+ because = () => packageRepositories = NugetCommon.GetRemoteRepositories(configuration, nugetLogger.Object);
}
[Fact]
@@ -53,7 +58,7 @@ public void should_create_repository_when_source_is_null()
because();
- ((AggregateRepository)packageRepository).Repositories.Count().ShouldEqual(0);
+ packageRepositories.Count().ShouldEqual(0);
}
}
}
diff --git a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs
index 38aeb2d3db..5df8ad9ef3 100644
--- a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs
+++ b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs
@@ -31,6 +31,8 @@ namespace chocolatey.tests.infrastructure.app.services
using chocolatey.infrastructure.commands;
using chocolatey.infrastructure.results;
using Moq;
+ using NuGet.Packaging;
+ using NuGet.Versioning;
using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem;
public class AutomaticUninstallerServiceSpecs
@@ -44,7 +46,7 @@ public abstract class AutomaticUninstallerServiceSpecsBase : TinySpec
protected Mock registryService = new Mock();
protected Mock commandExecutor = new Mock();
protected ChocolateyConfiguration config = new ChocolateyConfiguration();
- protected Mock package = new Mock();
+ protected Mock package = new Mock();
protected ConcurrentDictionary packageResults = new ConcurrentDictionary();
protected PackageResult packageResult;
protected ChocolateyPackageInformation packageInformation;
@@ -65,7 +67,7 @@ public override void Context()
config.PromptForConfirmation = false;
config.PackageNames = "regular";
package.Setup(p => p.Id).Returns("regular");
- package.Setup(p => p.Version).Returns(new SemanticVersion("1.2.0"));
+ package.Setup(p => p.Version).Returns(new NuGetVersion("1.2.0"));
packageResult = new PackageResult(package.Object, "c:\\packages\\thispackage");
packageInformation = new ChocolateyPackageInformation(package.Object);
registryKeys.Add(
@@ -114,7 +116,7 @@ public void should_log_why_it_skips_auto_uninstaller()
[Fact]
public void should_not_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Never);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Never);
}
[Fact]
@@ -298,7 +300,7 @@ public override void Because()
[Fact]
public void should_call_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
}
[Fact]
@@ -453,7 +455,7 @@ public override void Because()
[Fact]
public void should_call_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
}
[Fact]
@@ -501,7 +503,7 @@ public override void Because()
[Fact]
public void should_call_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
}
[Fact]
@@ -550,7 +552,7 @@ public override void Because()
[Fact]
public void should_call_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
}
[Fact]
@@ -600,7 +602,7 @@ public override void Because()
[Fact]
public void should_call_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
}
[Fact]
@@ -692,7 +694,7 @@ public override void Because()
[Fact]
public void should_call_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
}
[Fact]
@@ -747,7 +749,7 @@ public override void Because()
[Fact]
public void should_call_get_package_information()
{
- packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
+ packageInfoService.Verify(s => s.get_package_information(It.IsAny()), Times.Once);
}
[Fact]
diff --git a/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs
index 3a5070d86b..b100fd7c35 100644
--- a/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs
+++ b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs
@@ -32,6 +32,8 @@
namespace chocolatey.tests.infrastructure.app.services
{
+ using NuGet.Packaging;
+
public class ChocolateyPackageServiceSpecs
{
public abstract class ChocolateyPackageServiceSpecsBase : TinySpec
@@ -83,13 +85,13 @@ public override void Context()
NormalRunner.Setup(r => r.SourceType).Returns(SourceTypes.NORMAL);
FeaturesRunner.Setup(r => r.SourceType).Returns(SourceTypes.WINDOWS_FEATURES);
- var package = new Mock();
+ var package = new Mock();
var expectedResult = new ConcurrentDictionary();
expectedResult.TryAdd("test-feature", new PackageResult(package.Object, "windowsfeatures", null));
- FeaturesRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>()))
+ FeaturesRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>()))
.Returns(expectedResult);
- NormalRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>()))
+ NormalRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>()))
.Returns(new ConcurrentDictionary());
SourceRunners.AddRange(new[] { NormalRunner.Object, FeaturesRunner.Object });
@@ -124,20 +126,20 @@ public void should_return_package_that_should_have_been_installed()
[Test]
public void should_have_called_runner_for_windows_features_source()
{
- FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames == "test-feature"), It.IsAny>()), Times.Once);
+ FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames == "test-feature"), It.IsAny>()), Times.Once);
}
[Test]
public void should_not_have_called_runner_for_windows_features_source_with_other_package_names()
{
- FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != "test-feature"), It.IsAny>()), Times.Never);
+ FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != "test-feature"), It.IsAny>()), Times.Never);
}
[Test]
public void should_not_have_called_normal_source_runner_for_non_empty_packages()
{
// The normal source runners will be called with an argument
- NormalRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != string.Empty), It.IsAny>()), Times.Never);
+ NormalRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != string.Empty), It.IsAny>()), Times.Never);
}
}
}
diff --git a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs
index b96acbb26f..0209e21140 100644
--- a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs
+++ b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs
@@ -24,6 +24,8 @@ namespace chocolatey.tests.infrastructure.app.services
using chocolatey.infrastructure.app.domain;
using chocolatey.infrastructure.app.services;
using Moq;
+ using NuGet.Common;
+ using NuGet.Packaging;
using Should;
using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem;
@@ -36,7 +38,7 @@ public abstract class NugetServiceSpecsBase : TinySpec
protected Mock fileSystem = new Mock();
protected Mock nugetLogger = new Mock();
protected Mock filesService = new Mock();
- protected Mock package = new Mock();
+ protected Mock package = new Mock();
protected Mock packageDownloader = new Mock();
public override void Context()
@@ -47,7 +49,7 @@ public override void Context()
filesService.ResetCalls();
package.ResetCalls();
- service = new NugetService(fileSystem.Object, nugetLogger.Object, packageInfoService.Object, filesService.Object, packageDownloader.Object);
+ service = new NugetService(fileSystem.Object, nugetLogger.Object, packageInfoService.Object, filesService.Object);
}
}
@@ -305,7 +307,7 @@ public void generated_package_should_be_in_current_directory()
because();
- var infos = MockLogger.MessagesFor(LogLevel.Info);
+ var infos = MockLogger.MessagesFor(tests.LogLevel.Info);
infos.Count.ShouldEqual(1);
infos[0].ShouldEqual("Chocolatey would have searched for a nuspec file in \"c:\\projects\\chocolatey\" and attempted to compile it.");
}
@@ -319,7 +321,7 @@ public void generated_package_should_be_in_specified_directory()
because();
- var infos = MockLogger.MessagesFor(LogLevel.Info);
+ var infos = MockLogger.MessagesFor(tests.LogLevel.Info);
infos.Count.ShouldEqual(1);
infos[0].ShouldEqual("Chocolatey would have searched for a nuspec file in \"c:\\packages\" and attempted to compile it.");
}
diff --git a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs
index 82db549daa..3cdf1d4bab 100644
--- a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs
+++ b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs
@@ -28,8 +28,10 @@ namespace chocolatey.tests.infrastructure.app.services
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.services;
using Moq;
+ using NuGet.Common;
using NUnit.Framework;
using Should;
+ using LogLevel = tests.LogLevel;
public class TemplateServiceSpecs
{
@@ -38,13 +40,13 @@ public abstract class TemplateServiceSpecsBase : TinySpec
protected TemplateService service;
protected Mock fileSystem = new Mock();
protected Mock xmlService = new Mock();
+ protected Mock logger = new Mock();
public override void Context()
{
fileSystem.ResetCalls();
xmlService.ResetCalls();
-
- service = new TemplateService(fileSystem.Object, xmlService.Object);
+ service = new TemplateService(fileSystem.Object, xmlService.Object, logger.Object);
}
}
diff --git a/src/chocolatey.tests/packages.config b/src/chocolatey.tests/packages.config
index 0f56db505e..a9699f539c 100644
--- a/src/chocolatey.tests/packages.config
+++ b/src/chocolatey.tests/packages.config
@@ -1,10 +1,17 @@
+
+
+
+
+
-
+
+
+
\ No newline at end of file
diff --git a/src/chocolatey/chocolatey.csproj b/src/chocolatey/chocolatey.csproj
index 9167794d71..b49587725f 100644
--- a/src/chocolatey/chocolatey.csproj
+++ b/src/chocolatey/chocolatey.csproj
@@ -89,9 +89,51 @@
..\packages\log4net.2.0.12\lib\net45\log4net.dll
-
- False
- ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll
+
+
+ ..\packages\Microsoft.Web.Xdt.3.1.0\lib\net40\Microsoft.Web.XmlTransform.dll
+
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\Chocolatey.NuGet.Commands.6.4.1-zlocal.1\lib\net472\NuGet.Commands.dll
+
+
+ ..\packages\Chocolatey.NuGet.Common.6.4.1-zlocal.1\lib\net472\NuGet.Common.dll
+
+
+ ..\packages\Chocolatey.NuGet.Configuration.6.4.1-zlocal.1\lib\net472\NuGet.Configuration.dll
+
+
+ ..\packages\Chocolatey.Nuget.Credentials.6.4.1-zlocal.1\lib\net472\NuGet.Credentials.dll
+
+
+ ..\packages\Chocolatey.NuGet.DependencyResolver.Core.6.4.1-zlocal.1\lib\net472\NuGet.DependencyResolver.Core.dll
+
+
+ ..\packages\NuGet.Frameworks.6.4.1-zlocal.1\lib\net472\NuGet.Frameworks.dll
+
+
+ ..\packages\Chocolatey.NuGet.LibraryModel.6.4.1-zlocal.1\lib\net472\NuGet.LibraryModel.dll
+
+
+ ..\packages\Chocolatey.NuGet.PackageManagement.6.4.1-zlocal.1\lib\net472\NuGet.PackageManagement.dll
+
+
+ ..\packages\Chocolatey.NuGet.Packaging.6.4.1-zlocal.1\lib\net472\NuGet.Packaging.dll
+
+
+ ..\packages\Chocolatey.NuGet.ProjectModel.6.4.1-zlocal.1\lib\net472\NuGet.ProjectModel.dll
+
+
+ ..\packages\Chocolatey.NuGet.Protocol.6.4.1-zlocal.1\lib\net472\NuGet.Protocol.dll
+
+
+ ..\packages\Chocolatey.NuGet.Resolver.6.4.1-zlocal.1\lib\net472\NuGet.Resolver.dll
+
+
+ ..\packages\Chocolatey.NuGet.Versioning.6.4.1-zlocal.1\lib\net472\NuGet.Versioning.dll
..\..\lib\Rhino.Licensing.1.4.1\lib\net40\Rhino.Licensing.dll
@@ -100,13 +142,20 @@
..\packages\SimpleInjector.2.8.3\lib\net45\SimpleInjector.dll
+
+
+
+
+
False
..\..\lib\PowerShell\System.Management.Automation.dll
+
+
..\packages\Rx-Core.2.1.30214.0\lib\Net40\System.Reactive.Core.dll
@@ -117,6 +166,7 @@
..\packages\Rx-Linq.2.1.30214.0\lib\Net40\System.Reactive.Linq.dll
+
@@ -134,6 +184,7 @@
+
@@ -146,6 +197,9 @@
+
+
+
@@ -218,7 +272,6 @@
-
@@ -414,6 +467,7 @@
+