Beispiel #1
0
            public async Task DoesNotRetrySeriousFailures()
            {
                var leaf = CreateCatalogLeaf();

                ExternalIconContentProviderMock
                .SetupSequence(cp => cp.TryGetResponseAsync(
                                   It.Is <Uri>(u => u.AbsoluteUri == IconUrlString),
                                   CancellationToken.None))
                .ReturnsAsync(TryGetResponseResult.FailCannotRetry())
                .ReturnsAsync(
                    TryGetResponseResult.Success(
                        new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = ExternalIconContentMock.Object
                }));

                await Target.ProcessPackageDetailsLeafAsync(
                    DestinationStorageMock.Object,
                    IconCacheStorageMock.Object,
                    leaf,
                    IconUrlString,
                    null,
                    CancellationToken.None);

                ExternalIconContentProviderMock
                .Verify(
                    cp => cp.TryGetResponseAsync(
                        It.Is <Uri>(u => u.AbsoluteUri == IconUrlString),
                        CancellationToken.None),
                    Times.AtMostOnce);

                VerifyNoCopyFromExternalSource();
            }
Beispiel #2
0
            public async Task DeletesIconOnCopyFailure()
            {
                var leaf = CreateCatalogLeaf();

                ExternalIconContentProviderMock
                .Setup(cp => cp.TryGetResponseAsync(
                           It.Is <Uri>(u => u.AbsoluteUri == IconUrlString),
                           CancellationToken.None))
                .ReturnsAsync(TryGetResponseResult.FailCannotRetry());

                await Target.ProcessPackageDetailsLeafAsync(
                    DestinationStorageMock.Object,
                    IconCacheStorageMock.Object,
                    leaf,
                    IconUrlString,
                    null,
                    CancellationToken.None);

                IconProcessorMock
                .Verify(ip => ip.DeleteIconAsync(DestinationStorageMock.Object, "theid/3.4.2/icon", CancellationToken.None, leaf.PackageIdentity.Id, leaf.PackageIdentity.Version.ToNormalizedString()));
            }