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(); }
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())); }