Exemplo n.º 1
0
        public void BlobIfExistsShouldNotHitSecondary()
        {
            AssertSecondaryEndpoint();

            BlobRequestOptions options = new BlobRequestOptions();

            CloudBlobContainer container = BlobTestBase.GetRandomContainerReference();

            TestPrimaryOnlyCommand((opt, ctx) => container.CreateIfNotExists(opt, ctx), options);
            TestPrimaryOnlyCommand((opt, ctx) => container.EndCreateIfNotExists(container.BeginCreateIfNotExists(opt, ctx, null, null)), options);
            TestPrimaryOnlyCommand((opt, ctx) => container.DeleteIfExists(null, opt, ctx), options);
            TestPrimaryOnlyCommand((opt, ctx) => container.EndDeleteIfExists(container.BeginDeleteIfExists(null, opt, ctx, null, null)), options);

            CloudBlockBlob blockBlob = container.GetBlockBlobReference("blob1");

            TestPrimaryOnlyCommand((opt, ctx) => blockBlob.DeleteIfExists(DeleteSnapshotsOption.None, null, opt, ctx), options);
            TestPrimaryOnlyCommand((opt, ctx) => blockBlob.EndDeleteIfExists(blockBlob.BeginDeleteIfExists(DeleteSnapshotsOption.None, null, opt, ctx, null, null)), options);

            CloudPageBlob pageBlob = container.GetPageBlobReference("blob2");

            TestPrimaryOnlyCommand((opt, ctx) => pageBlob.DeleteIfExists(DeleteSnapshotsOption.None, null, opt, ctx), options);
            TestPrimaryOnlyCommand((opt, ctx) => pageBlob.EndDeleteIfExists(pageBlob.BeginDeleteIfExists(DeleteSnapshotsOption.None, null, opt, ctx, null, null)), options);
        }