Permalink
Browse files

Merge branch 'qa' of https://github.com/NuGet/NuGetGallery into qa

  • Loading branch information...
2 parents 03ee070 + 2395b16 commit b1a19ac5b21235bb4414abceb368c6cdf86cf1fa @claycompton claycompton committed Jan 30, 2014
@@ -91,6 +91,9 @@ public static IEnumerable<ValidationResult> Validate(ManifestMetadata metadata)
(metadata.DependencySets.Select(s => s.TargetFramework)));
foreach (var fx in fxes)
{
+ //if target framework is not specified, then continue. Validate only for wrong specification.
+ if (string.IsNullOrEmpty(fx))
+ continue;
ValidationResult result = null;
try
{
@@ -118,8 +118,8 @@ public partial class ApiController : AppController
DependentPackage = Request.Headers["NuGet-DependentPackage"],
ProjectGuids = Request.Headers["NuGet-ProjectGuids"],
};
-
- PackageService.AddDownloadStatistics(stats);
+ //Temporarily disable stats.
+ // PackageService.AddDownloadStatistics(stats);
}
catch (ReadOnlyModeException)
{
@@ -164,6 +164,32 @@ public void ReturnsErrorIfDependencySetContainsInvalidVersion()
}
[Fact]
+ public void NoErrorIfDependencySetContainsEmptyTargetFramework()
+ {
+ Manifest m = new Manifest()
+ {
+ Metadata = new ManifestMetadata()
+ {
+ Id = "valid",
+ Version = "1.0.0",
+ DependencySets = new List<ManifestDependencySet>()
+ {
+ new ManifestDependencySet() {
+ TargetFramework = "",
+ Dependencies = new List<ManifestDependency>() {
+ new ManifestDependency() {
+ Id = "a.b.c",
+ Version = "1.0-alpha"
+ }
+ }
+ }
+ }
+ }
+ };
+ Assert.Equal(GetErrors(m).Length, 0);
+ }
+
+ [Fact]
public void ReturnsErrorIfDependencySetContainsInvalidTargetFramework()
{
Manifest m = new Manifest()
@@ -190,6 +216,27 @@ public void ReturnsErrorIfDependencySetContainsInvalidTargetFramework()
}
[Fact]
+ public void NoErrorIfFrameworkAssemblyReferenceContainsEmptyTargetFramework()
+ {
+ Manifest m = new Manifest()
+ {
+ Metadata = new ManifestMetadata()
+ {
+ Id = "valid",
+ Version = "1.0.0",
+ FrameworkAssemblies = new List<ManifestFrameworkAssembly>()
+ {
+ new ManifestFrameworkAssembly() {
+ TargetFramework = "",
+ AssemblyName = "System.Awesome"
+ }
+ }
+ }
+ };
+ Assert.Equal(GetErrors(m).Length, 0);
+ }
+
+ [Fact]
public void ReturnsErrorIfFrameworkAssemblyReferenceContainsInvalidTargetFramework()
{
Manifest m = new Manifest()
@@ -336,7 +336,8 @@ public class TheGetPackageAction
var actionResult = new EmptyResult();
var controller = new TestableApiController(MockBehavior.Strict);
controller.MockPackageService.Setup(x => x.FindPackageByIdAndVersion(PackageId, "1.0.1", false)).Returns(package);
- controller.MockPackageService.Setup(x => x.AddDownloadStatistics(It.IsAny<PackageStatistics>())).Verifiable();
+ //Disable it temporarily as AddDownloadStats is not being invoked currently
+ // controller.MockPackageService.Setup(x => x.AddDownloadStatistics(It.IsAny<PackageStatistics>())).Verifiable();
controller.MockPackageFileService.Setup(s => s.CreateDownloadPackageActionResultAsync(HttpRequestUrl, PackageId, package.NormalizedVersion))
.Returns(Task.FromResult<ActionResult>(actionResult))
.Verifiable();
@@ -410,7 +411,8 @@ public class TheGetPackageAction
var actionResult = new EmptyResult();
var controller = new TestableApiController(MockBehavior.Strict);
controller.MockPackageService.Setup(x => x.FindPackageByIdAndVersion(PackageId, "", false)).Returns(package);
- controller.MockPackageService.Setup(x => x.AddDownloadStatistics(It.IsAny<PackageStatistics>())).Verifiable();
+ //Disable it temporarily as AddDownloadStats is not being invoked currently
+ // controller.MockPackageService.Setup(x => x.AddDownloadStatistics(It.IsAny<PackageStatistics>())).Verifiable();
controller.MockPackageFileService.Setup(s => s.CreateDownloadPackageActionResultAsync(HttpRequestUrl, PackageId, package.NormalizedVersion))
.Returns(Task.FromResult<ActionResult>(actionResult))

0 comments on commit b1a19ac

Please sign in to comment.