コード例 #1
0
        public void BlobHelperAddOrCreateBlobShouldSucceed()
        {
            var stream = Serializer.SerializeToByteArray(TestString);
            var helper = new AzureBlobHelper(Account, ContainerName);
            helper.CreateOrUpdate(BlobId, stream);
            stream.Close();

            var createdSuccessfully = helper.Exists(BlobId);
            createdSuccessfully.Should().BeTrue("The blob failed to be created or uploaded");
        }
コード例 #2
0
        public void BlobHelperDeleteBlobShouldSucceed()
        {
            var serializedKey = Serializer.SerializeToByteArray(TestString);
            var helper = new AzureBlobHelper(Account, ContainerName);
            helper.CreateOrUpdate(BlobId, serializedKey);

            var createdSuccessfully = helper.Exists(BlobId);
            createdSuccessfully.Should().BeTrue("The create or upload operation failed");

            helper.Delete(BlobId);

            var blobDoesExist = helper.Exists(BlobId);
            blobDoesExist.Should().BeFalse("The delete operation failed");
        }
コード例 #3
0
        public void BlobHelperGetShouldReturnTheCorrectObject()
        {
            var serializedKey = Serializer.SerializeToByteArray(TestString);
            var helper = new AzureBlobHelper(Account, ContainerName);
            helper.CreateOrUpdate(BlobId, serializedKey);

            var createdSuccessfully = helper.Exists(BlobId);
            createdSuccessfully.Should().BeTrue("The create or upload operation failed");

            var stream = helper.Get(BlobId);
            stream.Should().NotBeNull("Failed to get memory stream from blob");

            var deserializedObject = Serializer.DeserializeFromStream(stream);
            deserializedObject.Should().NotBeNull("Object was created successfully");
            
            TestString.ShouldBeEquivalentTo(deserializedObject);
        }