Exemple #1
0
        public void setup()
        {
            var metadata = new Dictionary <string, string> {
                { "key1", "value1" }, { "key2", "value2" }
            };

            setStorageItemInformation = new SetStorageItemMetaInformation("http://storageurl", "containername", "storageitemname", metadata);
        }
 public void Should_return_404_not_found_when_requested_object_does_not_exist()
 {
     using (new TestHelper(authToken, storageUrl))
     {
         try
         {
             Dictionary <string, string>   metadata = new Dictionary <string, string>();
             SetStorageItemMetaInformation setStorageItemMetaInformation = new SetStorageItemMetaInformation(storageUrl, Constants.CONTAINER_NAME, Guid.NewGuid().ToString(), metadata);
             new GenerateRequestByType().Submit(setStorageItemMetaInformation, authToken);
         }
         catch (Exception ex)
         {
             Assert.That(ex, Is.TypeOf(typeof(WebException)));
         }
     }
 }
        public void Should_return_accepted_when_meta_information_is_supplied()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer();

                Dictionary <string, string> metadata = new Dictionary <string, string>();
                metadata.Add("Test", "test");
                metadata.Add("Test2", "test2");

                SetStorageItemMetaInformation setStorageItemMetaInformation = new SetStorageItemMetaInformation(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, metadata);

                var metaInformationResponse = new GenerateRequestByType().Submit(setStorageItemMetaInformation, authToken);

                Assert.That(metaInformationResponse.Status, Is.EqualTo(HttpStatusCode.Accepted));
                testHelper.DeleteItemFromContainer();
            }
        }
 public void Should_throw_exception_when_meta_value_exceeds_256_characters()
 {
     using (new TestHelper(authToken, storageUrl))
     {
         try
         {
             Dictionary <string, string> metadata = new Dictionary <string, string> {
                 { new string('a', 10), new string('f', 257) }
             };
             SetStorageItemMetaInformation setStorageItemMetaInformation = new SetStorageItemMetaInformation(storageUrl, Constants.CONTAINER_NAME, Guid.NewGuid().ToString(), metadata);
             new GenerateRequestByType().Submit(setStorageItemMetaInformation, authToken);
         }
         catch (Exception ex)
         {
             Assert.That(ex, Is.TypeOf(typeof(MetaValueLengthException)));
         }
     }
 }