Permalink
Browse files

Fix blank package summary in Manage Packages dialog packages list.

Display NuGet package description if the summary is missing.
  • Loading branch information...
1 parent 176b283 commit f75a871712181577d5d3b16fad6f2b1ad4dd4c0a @mrward mrward committed Jan 3, 2013
View
7 src/AddIns/Misc/PackageManagement/Project/Src/PackageViewModel.cs
@@ -130,7 +130,12 @@ bool IsPackageInstalled()
}
public string Summary {
- get { return package.Summary; }
+ get {
+ if (!String.IsNullOrEmpty(package.Summary)) {
+ return package.Summary;
+ }
+ return package.Description;
+ }
}
public SemanticVersion Version {
View
23 src/AddIns/Misc/PackageManagement/Test/Src/PackageViewModelTests.cs
@@ -1246,5 +1246,28 @@ public void ManagePackage_TwoProjectsAndSecondSelectedInDialog_ProjectHasLoggerS
ILogger actualLogger = project.Logger;
Assert.AreEqual(expectedLogger, actualLogger);
}
+
+ [Test]
+ public void Summary_PackageHasSummary_PackageSummaryReturned()
+ {
+ CreateViewModel();
+ fakePackage.Summary = "Expected summary";
+
+ string summary = viewModel.Summary;
+
+ Assert.AreEqual("Expected summary", summary);
+ }
+
+ [Test]
+ public void Summary_PackageHasDescriptionButNoSummary_PackageDescriptionReturned()
+ {
+ CreateViewModel();
+ fakePackage.Summary = String.Empty;
+ fakePackage.Description = "Expected description";
+
+ string summary = viewModel.Summary;
+
+ Assert.AreEqual("Expected description", summary);
+ }
}
}

0 comments on commit f75a871

Please sign in to comment.