public void TestCreateContainerFailUnauthorized()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail-unauthorized";
            Assert.Throws <UnauthorizedException>(() => account.CreateContainer("foo"));
        }
        public void TestCreateContainerFailTimeout()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail-timeout";
            Assert.Throws <TimeoutException>(() => account.CreateContainer("foo"));
        }
        public void TestGetContainer()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "head-container";
            Assert.AreSame(account.GetContainer("foo").GetType(), typeof(CF_Container));
        }
        public void TestUpdateHeaders()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "post-object";
            account.UpdateHeaders(new Dictionary <string, string>());
        }
        public void TestGetContainers()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "get-account";
            Assert.AreSame(account.GetContainers().GetType(), typeof(List <Container>));
        }
        public void TestPublicContainerListFail()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail";
            Assert.Throws <CloudFilesException>(() => account.GetPublicContainerList());
        }
        public void TestGetPublicContainerList()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "get-account";
            Assert.AreSame(account.GetContainerList().GetType(), typeof(List <Dictionary <string, string> >));
        }
        public void TestGetPublicListFailUnauthorized()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail-401";
            Assert.Throws <UnauthorizedException>(() => account.GetPublicContainerList());
        }
        public void TestGetPublicListFailTimeout()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail--1";
            Assert.Throws <TimeoutException>(() => account.GetPublicContainerList());
        }
        public void TestDeleteContainerFailNotFound()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail-not-empty";
            Assert.Throws <ContainerNotEmptyException>(() => account.DeleteContainer("foo"));
        }
        public void TestDeleteContainer()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "delete-container";
            account.DeleteContainer("foo");
        }
        public void TestUpdateHeadersListFail()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail";
            Assert.Throws <CloudFilesException>(() => account.UpdateHeaders(new Dictionary <string, string>()));
        }
        public void TestCreateContainerFail()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail";
            Assert.Throws <CloudFilesException>(() => account.CreateContainer("foo"));
        }
        public void TestUpdateHeadersFailTimeout()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail-timeout";
            Assert.Throws <TimeoutException>(() => account.UpdateHeaders(new Dictionary <string, string>()));
        }
        public void TestUpdateHeadersFailUnauthorized()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail-unauthorized";
            Assert.Throws <UnauthorizedException>(() => account.UpdateHeaders(new Dictionary <string, string>()));
        }
Esempio n. 16
0
        public Factory(string username, string apiKey)
        {
            var creds = new UserCredentials(username, apiKey);

            _client     = new Client();
            _connection = new CF_Connection(creds, _client);
            _account    = new CF_Account(_connection, _client);
        }
        public void TestGetContainerFail()
        {
            var account = new CF_Account(_conn, _client);

            _conn.UserCreds.AuthToken = "fail";
            var ex = Assert.Throws <CloudFilesException>(() => account.GetContainer("foo"));

            Assert.That(ex.Message, Is.EqualTo("Error: 500"));
        }
        public void TestFailDeleteContainer()
        {
            var account = new CF_Account(_conn, _client)
            {
                Retries = 1
            };

            _conn.UserCreds.AuthToken = "fail-delete-container";
            account.DeleteContainer("foo");
        }
        public void TestFailCreateContainer()
        {
            var account = new CF_Account(_conn, _client)
            {
                Retries = 1
            };

            _conn.UserCreds.AuthToken = "fail-put-container";
            Assert.AreSame(account.CreateContainer("foo").GetType(), typeof(CF_Container));
        }
        public void TestFailUpdateMetadata()
        {
            var account = new CF_Account(_conn, _client)
            {
                Retries = 1
            };

            _conn.UserCreds.AuthToken = "fail-post-object";
            account.UpdateMetadata(new Dictionary <string, string>());
        }
        public void TestMembers()
        {
            _conn.UserCreds.AuthToken = "head-container";
            var account = new CF_Account(_conn, _client);

            Assert.AreEqual(account.Metadata["foo"], "foo");
            Assert.AreEqual(account.Headers["blah"], "foo");
            Assert.AreEqual(account.BytesUsed, 1);
            Assert.AreEqual(account.ObjectCount, 1);
            Assert.AreEqual(account.ContainerCount, 1);
            Assert.AreEqual(account.StorageUrl.ToString(), "https://foo.com/");
            Assert.AreEqual(account.CdnManagementUrl.ToString(), "https://foo.com/");
        }
Esempio n. 22
0
		private void CheckContainer()
		{
			var account = new CF_Account(_conn, _client);

			var list = account.GetContainers(new Dictionary<ContainerQuery, string> { { ContainerQuery.Prefix, ContainerName } });
			if (!list.Any(e => e.Name.Equals(ContainerName)))
			{
				if (!RackspaceIsCreateContainerIfNotFound)
				{
					throw new ApplicationException(String.Format("Container not found [{0}]", ContainerName));
				}
				account.CreateContainer(ContainerName);
			}
			_container = new CF_Container(_conn, _client, ContainerName);
		}
 public void TestGetPublicListFailUnauthorized()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail-401";
     Assert.Throws<UnauthorizedException>(() => account.GetPublicContainerList());
 }
 public void TestGetPublicListFailTimeout()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail--1";
     Assert.Throws<TimeoutException>(() => account.GetPublicContainerList());
 }
 public void TestDeleteContainerFailTimeout()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail-timeout";
     Assert.Throws<TimeoutException>(() => account.DeleteContainer("foo"));
 }
 public void TestMembers()
 {
     _conn.UserCreds.AuthToken = "head-container";
     var account = new CF_Account(_conn, _client);
     Assert.AreEqual(account.Metadata["foo"], "foo");
     Assert.AreEqual(account.Headers["blah"], "foo");
     Assert.AreEqual(account.BytesUsed, 1);
     Assert.AreEqual(account.ObjectCount, 1);
     Assert.AreEqual(account.ContainerCount, 1);
     Assert.AreEqual(account.StorageUrl.ToString(), "https://foo.com/");
     Assert.AreEqual(account.CdnManagementUrl.ToString(), "https://foo.com/");
 }
 public void TestFailUpdateHeaders()
 {
     var account = new CF_Account(_conn, _client) {Retries = 1};
     _conn.UserCreds.AuthToken = "fail-post-object";
     account.UpdateHeaders(new Dictionary<string, string>());
 }
 public void TestFailGetContainer()
 {
     var account = new CF_Account(_conn, _client) {Retries = 1};
     _conn.UserCreds.AuthToken = "fail-head-container";
     Assert.AreSame(account.GetContainer("foo").GetType(), typeof(CF_Container));
 }
 public void TestUpdateMetadataFailUnauthorized()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail-unauthorized";
     Assert.Throws<UnauthorizedException>(() => account.UpdateHeaders(new Dictionary<string, string>()));
 }
 public void TestGetContainers()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "get-account";
     Assert.AreSame(account.GetContainers().GetType(), typeof(List<Container>));
 }
 public void TestCreateContainerFail()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail";
     Assert.Throws<CloudFilesException>(() => account.CreateContainer("foo"));
 }
 public void TestUpdateMetadataListFail()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail";
     Assert.Throws<CloudFilesException>(() => account.UpdateMetadata(new Dictionary<string, string>()));
 }
 public void TestCreateContainerFailUnauthorized()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail-unauthorized";
     Assert.Throws<UnauthorizedException>(() => account.CreateContainer("foo"));
 }
 public void TestDeleteContainer()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "delete-container";
     account.DeleteContainer("foo");
 }
 public void TestDeleteContainerFailNotFound()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail-not-empty";
     Assert.Throws<ContainerNotEmptyException>(() => account.DeleteContainer("foo"));
 }
 public void TestGetPublicContainerList()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "get-account";
     Assert.AreSame(account.GetContainerList().GetType(), typeof(List<Dictionary<string, string>>));
 }
 public void TestUpdateMetadata()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "post-object";
     account.UpdateMetadata(new Dictionary<string, string>());
 }
 public void TestCreateContainer()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "put-container";
     Assert.AreSame(account.CreateContainer("foo").GetType(), typeof(CF_Container));
 }
 public void TestCreateContainerArgNull()
 {
     var account = new CF_Account(_conn, _client);
     Assert.Throws<ArgumentNullException>(() => account.CreateContainer(null));
 }
 public void TestGetContainerFail()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail";
     var ex = Assert.Throws<CloudFilesException>(() => account.GetContainer("foo"));
     Assert.That(ex.Message, Is.EqualTo("Error: 500"));
 }
 public void TestUpdateHeadersFailTimeout()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail-timeout";
     Assert.Throws<TimeoutException>(() => account.UpdateHeaders(new Dictionary<string, string>()));
 }
        public void TestCreateContainerArgNull()
        {
            var account = new CF_Account(_conn, _client);

            Assert.Throws <ArgumentNullException>(() => account.CreateContainer(null));
        }
 public void TestPublicContainerListFail()
 {
     var account = new CF_Account(_conn, _client);
     _conn.UserCreds.AuthToken = "fail";
     Assert.Throws<CloudFilesException>(() => account.GetPublicContainerList());
 }
Esempio n. 44
0
 private void CreateContainer()
 {
     var account = new CF_Account(_connection);
     _container = account.CreateContainer(_container.Name);
 }
 public void TestFailDeleteContainer()
 {
     var account = new CF_Account(_conn, _client) {Retries = 1};
     _conn.UserCreds.AuthToken = "fail-delete-container";
     account.DeleteContainer("foo");
 }