public async Task CreatesContainersIfConfigured() { Config.CreateContainers = true; await Target.ExecuteAsync(); CloudBlobClient.Verify(x => x.GetContainerReference(It.IsAny <string>()), Times.Exactly(3)); CloudBlobClient.Verify(x => x.GetContainerReference(Config.LegacyStorageContainer), Times.Once); CloudBlobClient.Verify(x => x.GetContainerReference(Config.GzippedStorageContainer), Times.Once); CloudBlobClient.Verify(x => x.GetContainerReference(Config.SemVer2StorageContainer), Times.Once); CloudBlobContainer.Verify(x => x.CreateIfNotExistAsync(It.Is <BlobContainerPermissions>(p => p.PublicAccess == BlobContainerPublicAccessType.Blob)), Times.Exactly(3)); }
public async Task DeserializesAllHiveTypes(HiveType hive) { var index = await Target.ReadIndexOrNullAsync(hive, "NuGet.Versioning"); Assert.NotNull(index); CloudBlobClient.Verify(x => x.GetContainerReference(It.IsAny <string>()), Times.Once); CloudBlobClient.Verify(x => x.GetContainerReference(GetContainerName(hive)), Times.Once); var container = GetContainer(hive); container.Verify(x => x.GetBlobReference(It.IsAny <string>()), Times.Once); container.Verify(x => x.GetBlobReference("nuget.versioning/index.json"), Times.Once); var blob = GetBlob(hive); blob.Verify(x => x.OpenReadAsync(It.IsAny <AccessCondition>()), Times.Once); blob.Verify(x => x.OpenReadAsync(It.Is <AccessCondition>(a => a.IfMatchETag == null && a.IfNoneMatchETag == null)), Times.Once); Assert.Equal(blob.Object.Uri.AbsoluteUri, index.Url); }
public async Task LoadsCursorsAndExecutesCollector() { await Target.ExecuteAsync(); HttpMessageHandler.Verify( x => x.OnSendAsync(It.IsAny <HttpRequestMessage>(), It.IsAny <CancellationToken>()), Times.Never); CloudBlobClient.Verify(x => x.GetContainerReference(It.IsAny <string>()), Times.Never); Storage.Protected().Verify( "OnLoadAsync", Times.Once(), ItExpr.IsAny <Uri>(), ItExpr.IsAny <CancellationToken>()); Storage.Protected().Verify( "OnLoadAsync", Times.Once(), new Uri("https://example/azs/cursor.json"), ItExpr.IsAny <CancellationToken>()); Collector.Verify( x => x.RunAsync(It.IsAny <DurableCursor>(), It.Is <MemoryCursor>(c => c.Value == DateTime.MaxValue.ToUniversalTime()), It.IsAny <CancellationToken>()), Times.Once); }