From bea889f414a447c1e5cbbcce953fc33e60da0f26 Mon Sep 17 00:00:00 2001 From: Damon Tivel Date: Wed, 28 Nov 2018 12:38:02 -0800 Subject: [PATCH] Monitoring: undo IsDelete change (#421) Progress on https://github.com/NuGet/NuGetGallery/issues/6686. --- src/Catalog/CatalogIndexEntry.cs | 2 +- tests/CatalogTests/CatalogIndexEntryTests.cs | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Catalog/CatalogIndexEntry.cs b/src/Catalog/CatalogIndexEntry.cs index c973466f7..48112b8dc 100644 --- a/src/Catalog/CatalogIndexEntry.cs +++ b/src/Catalog/CatalogIndexEntry.cs @@ -73,7 +73,7 @@ public bool IsDelete { get { - return Types.Any(type => type == "nuget:PackageDelete" || type == "PackageDelete" || type == Schema.DataTypes.PackageDelete.ToString()); + return Types.Any(type => type == "nuget:PackageDelete"); } } diff --git a/tests/CatalogTests/CatalogIndexEntryTests.cs b/tests/CatalogTests/CatalogIndexEntryTests.cs index f9fb44c60..224098bf1 100644 --- a/tests/CatalogTests/CatalogIndexEntryTests.cs +++ b/tests/CatalogTests/CatalogIndexEntryTests.cs @@ -251,15 +251,12 @@ public void IsDelete_WhenTypeIsNotPackageDelete_ReturnsFalse() Assert.False(entry.IsDelete); } - [Theory] - [InlineData(CatalogConstants.NuGetPackageDelete)] - [InlineData(CatalogConstants.PackageDelete)] - [InlineData("http://schema.nuget.org/schema#PackageDelete")] - public void IsDelete_WhenTypeIsPackageDelete_ReturnsTrue(string type) + [Fact] + public void IsDelete_WhenTypeIsPackageDelete_ReturnsTrue() { var entry = new CatalogIndexEntry( _uri, - type, + CatalogConstants.NuGetPackageDelete, _commitId, _commitTimeStamp, _packageIdentity); @@ -323,19 +320,16 @@ public void JsonDeserialization_WhenTypeIsPackageDetails_ReturnsCorrectObject() Assert.Equal(_packageVersion, entry.Version); } - [Theory] - [InlineData(CatalogConstants.NuGetPackageDelete)] - [InlineData(CatalogConstants.PackageDelete)] - [InlineData("http://schema.nuget.org/schema#PackageDelete")] - public void JsonDeserialization_WhenTypeIsPackageDelete_ReturnsCorrectObject(string type) + [Fact] + public void JsonDeserialization_WhenTypeIsPackageDelete_ReturnsCorrectObject() { - var jObject = CreateCatalogIndexJObject(type); + var jObject = CreateCatalogIndexJObject(CatalogConstants.NuGetPackageDelete); var json = jObject.ToString(Formatting.None, _settings.Converters.ToArray()); var entry = JsonConvert.DeserializeObject(json, _settings); Assert.Equal(_uri.AbsoluteUri, entry.Uri.AbsoluteUri); - Assert.Equal(type, entry.Types.Single()); + Assert.Equal(CatalogConstants.NuGetPackageDelete, entry.Types.Single()); Assert.True(entry.IsDelete); Assert.Equal(_commitId, entry.CommitId); Assert.Equal(_commitTimeStamp, entry.CommitTimeStamp);