Exemple #1
0
            public async Task DoesNotTryToCopyPrevioslyFailedIcons()
            {
                var leaf = CreateCatalogLeaf();

                IconCopyResultCacheMock
                .Setup(c => c.Get(It.Is <Uri>(u => u.AbsoluteUri == IconUrlString)))
                .Returns(ExternalIconCopyResult.Fail(new Uri(IconUrlString), TimeSpan.FromMinutes(1)));

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

                DestinationStorageMock
                .Verify(
                    ds => ds.CopyAsync(
                        It.IsAny <Uri>(),
                        It.IsAny <IStorage>(),
                        It.IsAny <Uri>(),
                        It.IsAny <IReadOnlyDictionary <string, string> >(),
                        It.IsAny <CancellationToken>()),
                    Times.Never);

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

                IconCopyResultCacheMock
                .Setup(c => c.Get(It.Is <Uri>(u => u.AbsoluteUri == IconUrlString)))
                .Returns(ExternalIconCopyResult.Fail(new Uri(IconUrlString), TimeSpan.FromHours(1)));

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