public FakeStorageBlockBlob(MemoryBlobStore store, string blobName, IStorageBlobContainer parent)
 {
     _store         = store;
     _blobName      = blobName;
     _parent        = parent;
     _containerName = parent.Name;
     _metadata      = new Dictionary <string, string>();
     _properties    = new FakeStorageBlobProperties();
     _sdkObject     = new CloudBlockBlob(new Uri("http://localhost/" + _containerName + "/" + blobName));
 }
 public FakeStorageBlockBlob(MemoryBlobStore store, string blobName, IStorageBlobContainer parent)
 {
     _store = store;
     _blobName = blobName;
     _parent = parent;
     _containerName = parent.Name;
     _metadata = new Dictionary<string, string>();
     _properties = new FakeStorageBlobProperties();
     _sdkObject = new CloudBlockBlob(new Uri("http://localhost/" + _containerName + "/" + blobName));
 }
Esempio n. 3
0
            public IEnumerable <IStorageBlob> ListBlobs(MemoryBlobStore store, IStorageBlobContainer parent,
                                                        BlobListingDetails blobListingDetails)
            {
                if (blobListingDetails != BlobListingDetails.None && blobListingDetails != BlobListingDetails.Metadata)
                {
                    throw new NotImplementedException();
                }
                List <IStorageBlob> results = new List <IStorageBlob>();

                foreach (KeyValuePair <string, Blob> item in _items)
                {
                    string blobName = item.Key;

                    // Etag  and LastModifiedTime is always passed in listBlobs
                    FakeStorageBlobProperties properties = new FakeStorageBlobProperties()
                    {
                        ETag         = item.Value.ETag,
                        LastModified = item.Value.LastModified,
                    };

                    IStorageBlob blob = new FakeStorageBlockBlob(store, blobName, parent, properties);
                    if ((blobListingDetails | BlobListingDetails.Metadata) == BlobListingDetails.Metadata)
                    {
                        Blob storeBlob = item.Value;
                        IReadOnlyDictionary <string, string> storeMetadata = storeBlob.Metadata;

                        foreach (KeyValuePair <string, string> pair in storeMetadata)
                        {
                            blob.Metadata.Add(pair.Key, pair.Value);
                        }
                    }

                    results.Add(blob);
                }

                return(results);
            }
            public IEnumerable<IStorageBlob> ListBlobs(MemoryBlobStore store, IStorageBlobContainer parent,
                BlobListingDetails blobListingDetails)
            {
                if (blobListingDetails != BlobListingDetails.None && blobListingDetails != BlobListingDetails.Metadata)
                {
                    throw new NotImplementedException();
                }
                List<IStorageBlob> results = new List<IStorageBlob>();

                foreach (KeyValuePair<string, Blob> item in _items)
                {
                    string blobName = item.Key;

                    // Etag  and LastModifiedTime is always passed in listBlobs
                    FakeStorageBlobProperties properties = new FakeStorageBlobProperties()
                    {
                        ETag = item.Value.ETag,
                        LastModified = item.Value.LastModified,
                    };

                    IStorageBlob blob = new FakeStorageBlockBlob(store, blobName, parent, properties);
                    if ((blobListingDetails | BlobListingDetails.Metadata) == BlobListingDetails.Metadata)
                    {
                        Blob storeBlob = item.Value;
                        IReadOnlyDictionary<string, string> storeMetadata = storeBlob.Metadata;

                        foreach (KeyValuePair<string, string> pair in storeMetadata)
                        {
                            blob.Metadata.Add(pair.Key, pair.Value);
                        }
                    }

                    results.Add(blob);
                }

                return results;
            }