I am currently participating in an upgrade from Azure 1.7 to 2.2 and am facing violation of changes in Storage. All storage calls in libraries are covered by unit tests, and I smoothed out most of the changes.
I am completely stuck in one of our main methods, which gets a list of subdirectories in a directory. I know that they are not actual directories, but are parts of blob names, but the functionality existed before 2.0, and we widely use it in almost 30 different services.
Memory address TestData / test / test1 / blob.txt
And test
[Test]
public void BuildDirectoryAndRetrieveUsingSubDirectory()
{
CloudBlobDirectory subDirectory = GetBlobDirectory("testdata/test/");
IEnumerable<CloudBlobDirectory> dirs =
subDirectory.ListBlobs().OfType<CloudBlobDirectory>();
Assert.AreEqual(1, dirs.Count());
}
The old 1.7 code for GetBlobDirectory returned a list of all blob blocks in testdata / test /, so in this case it will return test1
public static CloudBlobDirectory GetBlobDirectory(string directoryReference)
{
return BlobClient.GetBlobDirectoryReference(directoryReference);
}
I tried in vain to get the same results from using 2.0
public static CloudBlobDirectory GetBlobDirectory(string directoryReference)
{
string containerName = GetContainerNameFromDirectoryName(directoryReference);
CloudBlobContainer container = BlobClient.GetContainerReference(containerName);
return container.GetBlobDirectoryReference(directoryReference);
}
dirs " ".
- - , .