Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix updated packages from using the wrong active project after a pack…

…age is installed.
  • Loading branch information...
commit 4c5a64950723cf6146ce18345753c89e56572c63 1 parent e936e53
Matt Ward mrward authored
7 src/AddIns/Misc/PackageManagement/Project/Src/UpdatedPackagesViewModel.cs
View
@@ -11,7 +11,7 @@ namespace ICSharpCode.PackageManagement
{
public class UpdatedPackagesViewModel : PackagesViewModel
{
- IPackageManagementSolution solution;
+ PackageManagementSelectedProjects selectedProjects;
UpdatedPackages updatedPackages;
string errorMessage = String.Empty;
@@ -29,7 +29,7 @@ public class UpdatedPackagesViewModel : PackagesViewModel
}
public UpdatedPackagesViewModel(
- IPackageManagementSolution packageManagementService,
+ IPackageManagementSolution solution,
IRegisteredPackageRepositories registeredPackageRepositories,
UpdatedPackageViewModelFactory packageViewModelFactory,
ITaskFactory taskFactory)
@@ -38,7 +38,7 @@ public class UpdatedPackagesViewModel : PackagesViewModel
packageViewModelFactory,
taskFactory)
{
- this.solution = packageManagementService;
+ this.selectedProjects = new PackageManagementSelectedProjects(solution);
}
protected override void UpdateRepositoryBeforeReadPackagesTaskStarts()
@@ -54,7 +54,6 @@ protected override void UpdateRepositoryBeforeReadPackagesTaskStarts()
IQueryable<IPackage> GetInstalledPackages(IPackageRepository aggregateRepository)
{
- var selectedProjects = new PackageManagementSelectedProjects(solution);
return selectedProjects.GetInstalledPackages(aggregateRepository);
}
26 src/AddIns/Misc/PackageManagement/Test/Src/UpdatedPackagesViewModelTests.cs
View
@@ -158,5 +158,31 @@ public void ReadPackages_OnlySolutionSelectedAndOneNewerPackageVersionAvailable_
PackageCollectionAssert.AreEqual(expectedPackages, viewModel.PackageViewModels);
}
+
+ [Test]
+ public void ReadPackages_SolutionInitiallySelectedWithOneNewerPackageAndProjectSelectedBeforeSecondReadOfPackages_NewerPackageVersionDisplayed()
+ {
+ CreateSolution();
+ NoProjectsSelected();
+ CreateViewModel(solution);
+ AddPackageToSolution("1.0.0.0");
+ FakePackage newerPackage = AddPackageToAggregateRepository("1.1.0.0");
+
+ viewModel.ReadPackages();
+ CompleteReadPackagesTask();
+
+ TestableProject msbuildProject = ProjectHelper.CreateTestProject("Test");
+ solution.FakeActiveMSBuildProject = msbuildProject;
+ solution.FakeActiveProject = new FakePackageManagementProject("Test");
+
+ viewModel.ReadPackages();
+ CompleteReadPackagesTask();
+
+ var expectedPackages = new FakePackage[] {
+ newerPackage
+ };
+
+ PackageCollectionAssert.AreEqual(expectedPackages, viewModel.PackageViewModels);
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.