コード例 #1
0
            public async Task SetsExpectedProperties()
            {
                var document = _target.UpdateOwners(
                    Data.PackageId,
                    Data.SearchFilters,
                    Data.Owners);

                SetDocumentLastUpdated(document);
                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Equal(@"{
  ""value"": [
    {
      ""@search.action"": ""upload"",
      ""owners"": [
        ""Microsoft"",
        ""azure-sdk""
      ],
      ""lastUpdatedDocument"": ""2018-12-14T09:30:00+00:00"",
      ""lastDocumentType"": ""NuGet.Services.AzureSearch.SearchDocument+UpdateOwners"",
      ""lastUpdatedFromCatalog"": false,
      ""key"": ""windowsazure_storage-d2luZG93c2F6dXJlLnN0b3JhZ2U1-IncludePrereleaseAndSemVer2""
    }
  ]
}", json);
            }
コード例 #2
0
            public async Task SetsExpectedProperties()
            {
                var document = _target.LatestFromCatalog(
                    Data.PackageId,
                    Data.NormalizedVersion,
                    Data.CommitTimestamp,
                    Data.CommitId,
                    Data.HijackDocumentChanges);

                SetDocumentLastUpdated(document);
                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Equal(@"{
  ""value"": [
    {
      ""@search.action"": ""upload"",
      ""isLatestStableSemVer1"": false,
      ""isLatestSemVer1"": true,
      ""isLatestStableSemVer2"": false,
      ""isLatestSemVer2"": true,
      ""lastCommitTimestamp"": ""2018-12-13T12:30:00+00:00"",
      ""lastCommitId"": ""6b9b24dd-7aec-48ae-afc1-2a117e3d50d1"",
      ""lastUpdatedDocument"": ""2018-12-14T09:30:00+00:00"",
      ""lastDocumentType"": ""NuGet.Services.AzureSearch.HijackDocument+Latest"",
      ""lastUpdatedFromCatalog"": true,
      ""key"": ""windowsazure_storage_7_1_2-alpha-d2luZG93c2F6dXJlLnN0b3JhZ2UvNy4xLjItYWxwaGE1""
    }
  ]
}", json);
            }
コード例 #3
0
            public async Task SerializesNullSemVerLevel()
            {
                var package = Data.PackageEntity;

                package.SemVerLevelKey = SemVerLevelKey.Unknown;

                var document = _target.FullFromDb(Data.PackageId, Data.HijackDocumentChanges, package);

                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Contains("\"semVerLevel\": null,", json);
            }
コード例 #4
0
            public async Task SetsExpectedProperties()
            {
                var document = _target.Keyed(Data.PackageId, Data.NormalizedVersion);

                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Equal(@"{
  ""value"": [
    {
      ""@search.action"": ""upload"",
      ""key"": ""windowsazure_storage_7_1_2-alpha-d2luZG93c2F6dXJlLnN0b3JhZ2UvNy4xLjItYWxwaGE1""
    }
  ]
}", json);
            }
コード例 #5
0
            public async Task SetsExpectedProperties()
            {
                var document = _target.Keyed(Data.PackageId, Data.SearchFilters);

                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Equal(@"{
  ""value"": [
    {
      ""@search.action"": ""upload"",
      ""key"": ""windowsazure_storage-d2luZG93c2F6dXJlLnN0b3JhZ2U1-IncludePrereleaseAndSemVer2""
    }
  ]
}", json);
            }
コード例 #6
0
            public async Task SetsExpectedProperties(bool isLatestStable, bool isLatest)
            {
                var document = _target.UpdateVersionListAndOwnersFromCatalog(
                    Data.PackageId,
                    Data.SearchFilters,
                    Data.CommitTimestamp,
                    Data.CommitId,
                    Data.Versions,
                    isLatestStable,
                    isLatest,
                    Data.Owners);

                SetDocumentLastUpdated(document);
                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Equal(@"{
  ""value"": [
    {
      ""@search.action"": ""upload"",
      ""owners"": [
        ""Microsoft"",
        ""azure-sdk""
      ],
      ""versions"": [
        ""1.0.0"",
        ""2.0.0+git"",
        ""3.0.0-alpha.1"",
        ""7.1.2-alpha+git""
      ],
      ""isLatestStable"": " + isLatestStable.ToString().ToLowerInvariant() + @",
      ""isLatest"": " + isLatest.ToString().ToLowerInvariant() + @",
      ""lastCommitTimestamp"": ""2018-12-13T12:30:00+00:00"",
      ""lastCommitId"": ""6b9b24dd-7aec-48ae-afc1-2a117e3d50d1"",
      ""lastUpdatedDocument"": ""2018-12-14T09:30:00+00:00"",
      ""lastDocumentType"": ""NuGet.Services.AzureSearch.SearchDocument+UpdateVersionListAndOwners"",
      ""lastUpdatedFromCatalog"": true,
      ""key"": ""windowsazure_storage-d2luZG93c2F6dXJlLnN0b3JhZ2U1-IncludePrereleaseAndSemVer2""
    }
  ]
}", json);
            }
コード例 #7
0
            public async Task SerializesNullSemVerLevel()
            {
                var package = Data.PackageEntity;

                package.SemVerLevelKey = SemVerLevelKey.Unknown;

                var document = _target.FullFromDb(
                    Data.PackageId,
                    Data.SearchFilters,
                    Data.Versions,
                    isLatestStable: false,
                    isLatest: true,
                    fullVersion: Data.FullVersion,
                    package: package,
                    owners: Data.Owners,
                    totalDownloadCount: Data.TotalDownloadCount,
                    isExcludedByDefault: false);

                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Contains("\"semVerLevel\": null,", json);
            }
コード例 #8
0
            public async Task SetsExpectedProperties()
            {
                var document = _target.FullFromCatalog(Data.NormalizedVersion, Data.HijackDocumentChanges, Data.Leaf);

                SetDocumentLastUpdated(document);
                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Equal(@"{
  ""value"": [
    {
      ""@search.action"": ""upload"",
      ""listed"": true,
      ""isLatestStableSemVer1"": false,
      ""isLatestSemVer1"": true,
      ""isLatestStableSemVer2"": false,
      ""isLatestSemVer2"": true,
      ""semVerLevel"": 2,
      ""authors"": ""Microsoft"",
      ""copyright"": ""© Microsoft Corporation. All rights reserved."",
      ""created"": ""2017-01-01T00:00:00+00:00"",
      ""description"": ""Description."",
      ""fileSize"": 3039254,
      ""flattenedDependencies"": ""Microsoft.Data.OData:5.6.4:net40-client|Newtonsoft.Json:6.0.8:net40-client"",
      ""hash"": ""oMs9XKzRTsbnIpITcqZ5XAv1h2z6oyJ33+Z/PJx36iVikge/8wm5AORqAv7soKND3v5/0QWW9PQ0ktQuQu9aQQ=="",
      ""hashAlgorithm"": ""SHA512"",
      ""iconUrl"": ""http://go.microsoft.com/fwlink/?LinkID=288890"",
      ""language"": ""en-US"",
      ""lastEdited"": ""2017-01-02T00:00:00+00:00"",
      ""licenseUrl"": ""http://go.microsoft.com/fwlink/?LinkId=331471"",
      ""minClientVersion"": ""2.12"",
      ""normalizedVersion"": ""7.1.2-alpha"",
      ""originalVersion"": ""7.1.2.0-alpha+git"",
      ""packageId"": ""WindowsAzure.Storage"",
      ""prerelease"": true,
      ""projectUrl"": ""https://github.com/Azure/azure-storage-net"",
      ""published"": ""2017-01-03T00:00:00+00:00"",
      ""releaseNotes"": ""Release notes."",
      ""requiresLicenseAcceptance"": true,
      ""sortableTitle"": ""windows azure storage"",
      ""summary"": ""Summary."",
      ""tags"": [
        ""Microsoft"",
        ""Azure"",
        ""Storage"",
        ""Table"",
        ""Blob"",
        ""File"",
        ""Queue"",
        ""Scalable"",
        ""windowsazureofficial""
      ],
      ""title"": ""Windows Azure Storage"",
      ""tokenizedPackageId"": ""WindowsAzure.Storage"",
      ""lastCommitTimestamp"": ""2018-12-13T12:30:00+00:00"",
      ""lastCommitId"": ""6b9b24dd-7aec-48ae-afc1-2a117e3d50d1"",
      ""lastUpdatedDocument"": ""2018-12-14T09:30:00+00:00"",
      ""lastDocumentType"": ""NuGet.Services.AzureSearch.HijackDocument+Full"",
      ""lastUpdatedFromCatalog"": true,
      ""key"": ""windowsazure_storage_7_1_2-alpha-d2luZG93c2F6dXJlLnN0b3JhZ2UvNy4xLjItYWxwaGE1""
    }
  ]
}", json);
            }
コード例 #9
0
            public async Task SetsExpectedProperties(SearchFilters searchFilters, string expected)
            {
                var document = _target.FullFromDb(
                    Data.PackageId,
                    searchFilters,
                    Data.Versions,
                    isLatestStable: false,
                    isLatest: true,
                    fullVersion: Data.FullVersion,
                    package: Data.PackageEntity,
                    owners: Data.Owners,
                    totalDownloadCount: Data.TotalDownloadCount,
                    isExcludedByDefault: false);

                SetDocumentLastUpdated(document);
                var json = await SerializationUtilities.SerializeToJsonAsync(document);

                Assert.Equal(@"{
  ""value"": [
    {
      ""@search.action"": ""upload"",
      ""totalDownloadCount"": 1001,
      ""downloadScore"": 0.14381174563233068,
      ""isExcludedByDefault"": false,
      ""owners"": [
        ""Microsoft"",
        ""azure-sdk""
      ],
      ""searchFilters"": """ + expected + @""",
      ""filterablePackageTypes"": [
        ""dependency""
      ],
      ""fullVersion"": ""7.1.2-alpha+git"",
      ""versions"": [
        ""1.0.0"",
        ""2.0.0+git"",
        ""3.0.0-alpha.1"",
        ""7.1.2-alpha+git""
      ],
      ""packageTypes"": [
        ""Dependency""
      ],
      ""isLatestStable"": false,
      ""isLatest"": true,
      ""semVerLevel"": 2,
      ""authors"": ""Microsoft"",
      ""copyright"": ""© Microsoft Corporation. All rights reserved."",
      ""created"": ""2017-01-01T00:00:00+00:00"",
      ""description"": ""Description."",
      ""fileSize"": 3039254,
      ""flattenedDependencies"": ""Microsoft.Data.OData:5.6.4:net40-client|Newtonsoft.Json:6.0.8:net40-client"",
      ""hash"": ""oMs9XKzRTsbnIpITcqZ5XAv1h2z6oyJ33+Z/PJx36iVikge/8wm5AORqAv7soKND3v5/0QWW9PQ0ktQuQu9aQQ=="",
      ""hashAlgorithm"": ""SHA512"",
      ""iconUrl"": ""http://go.microsoft.com/fwlink/?LinkID=288890"",
      ""language"": ""en-US"",
      ""lastEdited"": ""2017-01-02T00:00:00+00:00"",
      ""licenseUrl"": ""http://go.microsoft.com/fwlink/?LinkId=331471"",
      ""minClientVersion"": ""2.12"",
      ""normalizedVersion"": ""7.1.2-alpha"",
      ""originalVersion"": ""7.1.2.0-alpha+git"",
      ""packageId"": ""WindowsAzure.Storage"",
      ""prerelease"": true,
      ""projectUrl"": ""https://github.com/Azure/azure-storage-net"",
      ""published"": ""2017-01-03T00:00:00+00:00"",
      ""releaseNotes"": ""Release notes."",
      ""requiresLicenseAcceptance"": true,
      ""sortableTitle"": ""windows azure storage"",
      ""summary"": ""Summary."",
      ""tags"": [
        ""Microsoft"",
        ""Azure"",
        ""Storage"",
        ""Table"",
        ""Blob"",
        ""File"",
        ""Queue"",
        ""Scalable"",
        ""windowsazureofficial""
      ],
      ""title"": ""Windows Azure Storage"",
      ""tokenizedPackageId"": ""WindowsAzure.Storage"",
      ""lastCommitTimestamp"": null,
      ""lastCommitId"": null,
      ""lastUpdatedDocument"": ""2018-12-14T09:30:00+00:00"",
      ""lastDocumentType"": ""NuGet.Services.AzureSearch.SearchDocument+Full"",
      ""lastUpdatedFromCatalog"": false,
      ""key"": ""windowsazure_storage-d2luZG93c2F6dXJlLnN0b3JhZ2U1-" + expected + @"""
    }
  ]
}", json);
            }