示例#1
0
        public void GetBlobsByPrefix()
        {
            string             containerName = Utility.GenNameString("container");
            CloudBlobContainer container     = blobUtil.CreateContainer(containerName);

            try
            {
                List <string> blobNames = new List <string>();

                int count = random.Next(2, 4);
                for (int i = 0; i < count; i++)
                {
                    blobNames.Add(Utility.GenNameString("blobprefix"));
                }

                List <CloudBlob> blobs = blobUtil.CreateRandomBlob(container, blobNames);

                Test.Assert(CommandAgent.GetAzureStorageBlobByPrefix("blobprefix", containerName), Utility.GenComparisonData("Get-AzureStorageBlob with prefix", true));
                Test.Assert(CommandAgent.Output.Count == blobs.Count, String.Format("Expect to retrieve {0} blobs, but retrieved {1} blobs", blobs.Count, CommandAgent.Output.Count));

                CommandAgent.OutputValidation(blobs);
            }
            finally
            {
                blobUtil.RemoveContainer(containerName);
            }
        }