public void should_return_only_objects_beginning_with_the_provided_substring() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); container.AddObject(Constants.HEAD_STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.HEAD_STORAGE_ITEM_NAME), Is.True); string[] objectNames = container.GetObjectNames(); Assert.That(objectNames.Length, Is.EqualTo(2)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); Assert.That(objectNames[1], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); var parameters = new Dictionary <GetItemListParameters, string> { { GetItemListParameters.Prefix, "h" } }; objectNames = container.GetObjectNames(parameters); Assert.That(objectNames.Length, Is.EqualTo(1)); Assert.That(objectNames[0], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); parameters.Clear(); parameters.Add(GetItemListParameters.Prefix, "t"); objectNames = container.GetObjectNames(parameters); Assert.That(objectNames.Length, Is.EqualTo(1)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); }
public void should_add_the_object() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); }
public void should_add_the_object() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); string[] objectNames = container.GetObjectNames(); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); }
public void should_give_the_object_public_url() { var container = new MockCFContainer("testcontainername"); container.MarkAsPublic(); var @object = container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(@object.PublicUrl.ToString(), Is.EqualTo("http://tempuri.org/" + Constants.STORAGE_ITEM_NAME)); }
public void should_return_xml_document_with_objects_names_and_hash_and_bytes_and_content_type_and_last_modified_date() { var container = new MockCFContainer("testcontainername"); container.AddObject("object"); const string expectedXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><container name=\"testcontainername\"><object><name>object</name><hash>4281c348eaf83e70ddce0e07221c3d28</hash><bytes>14</bytes><content_type>application/octet-stream</content_type><last_modified>2009-02-03T05:26:32.612278</last_modified></object></container>"; Assert.That(container.XML.InnerXml, Is.EqualTo(expectedXml)); }
public void should_return_json_string_with_object_names_and_hash_and_bytes_and_content_type_and_last_modified_date() { var container = new MockCFContainer("testcontainername"); container.AddObject("test_object_1"); const string expectedJson = "[{\"name\":[ ]?\"test_object_1\",[ ]?\"hash\":[ ]?\"4281c348eaf83e70ddce0e07221c3d28\",[ ]?\"bytes\":[ ]?14,[ ]?\"content_type\":[ ]?\"application\\/octet-stream\",[ ]?\"last_modified\":[ ]?\"2009-02-03T05:26:32.612278\"}]"; Assert.That(container.JSON, Is.EqualTo(expectedJson)); }
public void should_return_only_the_specified_number_of_objects() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); container.AddObject(Constants.HEAD_STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.HEAD_STORAGE_ITEM_NAME), Is.True); string[] objectNames = container.GetObjectNames(); Assert.That(objectNames.Length, Is.EqualTo(2)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); Assert.That(objectNames[1], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); var parameters = new Dictionary <GetItemListParameters, string> { { GetItemListParameters.Limit, "1" } }; objectNames = container.GetObjectNames(parameters); Assert.That(objectNames.Length, Is.EqualTo(1)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); }
public void should_return_xml_document_with_objects_names_and_hash_and_bytes_and_content_type_and_last_modified_date() { var container = new MockCFContainer("testcontainername"); container.AddObject("object"); var expectedXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><container name=\"testcontainername\"><object><name>object</name><hash>4281c348eaf83e70ddce0e07221c3d28</hash><bytes>14</bytes><content_type>application/octet-stream</content_type><last_modified>2009-02-03T05:26:32.612278</last_modified></object></container>"; Assert.That(container.XML.InnerXml, Is.EqualTo(expectedXml)); }
public void should_return_json_string_with_object_names_and_hash_and_bytes_and_content_type_and_last_modified_date() { var container = new MockCFContainer("testcontainername"); container.AddObject("test_object_1"); var expectedJson = "[{\"name\":\"test_object_1\",\"hash\":\"4281c348eaf83e70ddce0e07221c3d28\",\"bytes\":14,\"content_type\":\"application\\/octet-stream\",\"last_modified\":\"2009-02-03T05:26:32.612278\"}]"; Assert.That(container.JSON, Is.EqualTo(expectedJson)); }
public void should_return_only_objects_beginning_with_the_provided_substring() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); container.AddObject(Constants.HEAD_STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.HEAD_STORAGE_ITEM_NAME), Is.True); string[] objectNames = container.GetObjectNames(); Assert.That(objectNames.Length, Is.EqualTo(2)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); Assert.That(objectNames[1], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); Dictionary<GetItemListParameters, string> parameters = new Dictionary<GetItemListParameters, string>(); parameters.Add(GetItemListParameters.Prefix, "h"); objectNames = container.GetObjectNames(parameters); Assert.That(objectNames.Length, Is.EqualTo(1)); Assert.That(objectNames[0], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); parameters.Clear(); parameters.Add(GetItemListParameters.Prefix, "t"); objectNames = container.GetObjectNames(parameters); Assert.That(objectNames.Length, Is.EqualTo(1)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); }
public void should_return_only_objects_greater_than_the_marker_value() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); container.AddObject(Constants.HEAD_STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.HEAD_STORAGE_ITEM_NAME), Is.True); string[] objectNames = container.GetObjectNames(); Assert.That(objectNames.Length, Is.EqualTo(2)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); Assert.That(objectNames[1], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); Dictionary<GetItemListParameters, string> parameters = new Dictionary<GetItemListParameters, string>(); parameters.Add(GetItemListParameters.Marker, "1"); objectNames = container.GetObjectNames(parameters); Assert.That(objectNames.Length, Is.EqualTo(1)); Assert.That(objectNames[0], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); }
public void should_delete_the_object() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); container.DeleteObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.False); }
public void should_add_the_object() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); Assert.That(container.ObjectCount, Is.EqualTo(1)); Assert.That(container.BytesUsed, Is.EqualTo(34)); }
public void should_return_only_the_specified_number_of_objects() { var container = new MockCFContainer("testcontainername"); container.AddObject(Constants.STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.STORAGE_ITEM_NAME), Is.True); container.AddObject(Constants.HEAD_STORAGE_ITEM_NAME); Assert.That(container.ObjectExists(Constants.HEAD_STORAGE_ITEM_NAME), Is.True); string[] objectNames = container.GetObjectNames(); Assert.That(objectNames.Length, Is.EqualTo(2)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); Assert.That(objectNames[1], Is.EqualTo(Constants.HEAD_STORAGE_ITEM_NAME)); var parameters = new Dictionary<GetItemListParameters, string> {{GetItemListParameters.Limit, "1"}}; objectNames = container.GetObjectNames(parameters); Assert.That(objectNames.Length, Is.EqualTo(1)); Assert.That(objectNames[0], Is.EqualTo(Constants.STORAGE_ITEM_NAME)); }