Ejemplo n.º 1
0
        public void should_return_xml_document_with_account_name()
        {
            var account = new MockCFAccount();
            const string expectedXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><account name=\"MossoCloudFS_5d8f3dca-7eb9-4453-aa79-2eea1b980353\"></account>";

            Assert.That(account.XML.InnerXml, Is.EqualTo(expectedXml));
        }
Ejemplo n.º 2
0
        public void should_give_you_container_instance_when_successful()
        {
            var account = new MockCFAccount();
            Assert.That(account.ContainerExists("testcontainername"), Is.False);
            IContainer container = account.CreateContainer("testcontainername");

            Assert.That(account.ContainerExists("testcontainername"), Is.True);
            Assert.That(container.Name, Is.EqualTo("testcontainername"));
            Assert.That(account.ContainerCount, Is.EqualTo(1));
            Assert.That(account.BytesUsed, Is.EqualTo(34));
        }
Ejemplo n.º 3
0
 public void should_return_json_string_emptry_brackets()
 {
     var account = new MockCFAccount();
     const string expectedJson = "[]";
     Assert.That(account.JSON, Is.EqualTo(expectedJson));
 }
Ejemplo n.º 4
0
        public void should_return_xml_document_with_container_names_and_item_count_and_bytes_used()
        {
            var account = new MockCFAccount();
            account.CreateContainer("container");
            const string expectedXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><account name=\"MossoCloudFS_5d8f3dca-7eb9-4453-aa79-2eea1b980353\"><container><name>container</name><count>0</count><bytes>0</bytes></container></account>";

            Assert.That(account.XML.InnerXml, Is.EqualTo(expectedXml));
        }
Ejemplo n.º 5
0
 public void should_return_json_string_with_container_names_and_item_count_and_bytes_used()
 {
     var account = new MockCFAccount();
     account.CreateContainer("container");
     const string expectedJson = "[{\"name\":[ ]?\"container\",[ ]?\"count\":[ ]?0,[ ]?\"bytes\":[ ]?0}]";
     Assert.That(account.JSON, Is.EqualTo(expectedJson));
 }
Ejemplo n.º 6
0
        public void should_throw_container_not_empty_exception_if_the_container_not_empty()
        {
            var account = new MockCFAccount();
            account.DeleteContainer("testcontainername");

            Assert.Fail("Allowed deletion of non-existant container");
        }
Ejemplo n.º 7
0
        public void should_do_nothing_when_successful()
        {
            var account = new MockCFAccount();
            account.CreateContainer("testcontainername");
            Assert.That(account.ContainerExists("testcontainername"), Is.True);
            account.DeleteContainer("testcontainername");

            Assert.That(account.ContainerExists("testcontainername"), Is.False);
        }
Ejemplo n.º 8
0
        public void should_throw_argument_null_exception_if_the_container_name_is_null()
        {
            var account = new MockCFAccount();
            account.ContainerExists(null);

            Assert.Fail("Allowed ContainerExists to be called with null parameter");
        }
Ejemplo n.º 9
0
        public void should_throw_container_already_exists_exception()
        {
            var account = new MockCFAccount();
            Assert.That(account.ContainerExists("alreadyexistingcontainer"), Is.False);
            account.CreateContainer("alreadyexistingcontainer");
            Assert.That(account.ContainerExists("alreadyexistingcontainer"), Is.True);
            account.CreateContainer("alreadyexistingcontainer");

            Assert.Fail("Allowed CreateContainer to be called when container already existed");
        }