public void GetBlockList_CommittedAndUncommittedBlocksExistsRequestAll_GetsAllBlocksCorrectly()
        {
            const string dataPerBlock = "foo";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Committed);
            var uncommittedBlockList = _util.CreateBlockIdList(3, PutBlockListListType.Uncommitted);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            var uncommittedBlockIds = _util.GetIdsFromBlockIdList(uncommittedBlockList);
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            _util.PutBlockList(containerName, blobName, blockIds);
            _util.CreateBlockList(containerName, blobName, uncommittedBlockIds, dataPerBlock);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var response = client.GetBlockList(containerName, blobName, null, GetBlockListListType.All);

            Assert.Greater(response.UncommittedBlocks.Count, 0);
            Assert.Greater(response.CommittedBlocks.Count, 0);
            _util.AssertBlockListsAreEqual(containerName, blobName, response);
        }
        public void GetBlockList_RequiredArgsOnly_GetsCorrectUncommittedBlocks()
        {
            const string dataPerBlock = "foo";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Uncommitted);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var response = client.GetBlockList(containerName, blobName, null, GetBlockListListType.All);

            Assert.Greater(response.UncommittedBlocks.Count, 0);
            _util.AssertBlockListsAreEqual(containerName, blobName, BlockListingFilter.Uncommitted, response.UncommittedBlocks);
        }
        public void GetBlockList_BlobWithNoCommittedBlocks_GetsZeroContentLength()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Uncommitted);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            _util.CreateBlockList(containerName, blobName, blockIds, "foo");
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var response = client.GetBlockList(containerName, blobName, null, GetBlockListListType.All);

            Assert.AreEqual(0, response.BlobContentLength);
        }
        public void GetBlockList_BlobWithCommittedBlocks_GetsNonZeroContentLength()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, content: "A Committed Block");
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var response = client.GetBlockList(containerName, blobName, null, GetBlockListListType.All);

            Assert.Greater(response.BlobContentLength, 0);
        }
        public void GetBlockList_BlobWithCommittedBlocks_GetsPopulatedETag()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, content: "A Committed Block");
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var response = client.GetBlockList(containerName, blobName, null, GetBlockListListType.All);

            Assert.IsNotEmpty(response.ETag);
        }