public void SetUp()
 {
     item = new PutStorageDirectory("http://storeme", "itemcont", "/dir1/dir2");
     url = item.CreateUri();
 }
예제 #2
0
        private void MakeStorageDirectory(string containerName, string remoteobjname)
        {
            if (string.IsNullOrEmpty(containerName) ||
                string.IsNullOrEmpty(remoteobjname))
                throw new ArgumentNullException();

            Log.Debug(this, "Putting storage item "
                           + remoteobjname + " with metadata into container '"
                           + containerName + "' for user "
                           + _usercreds.Username);

            try
            {
                var makedirectory = new PutStorageDirectory(StorageUrl, containerName, remoteobjname);
                _requestfactory.Submit(makedirectory, AuthToken, _usercreds.ProxyCredentials);
            }
            catch (WebException webException)
            {
                Log.Error(this, "Error putting storage item "
                                + remoteobjname + " with metadata into container '"
                                + containerName + "' for user "
                                + _usercreds.Username, webException);

                var webResponse = (HttpWebResponse)webException.Response;
                if (webResponse == null) throw;
                if (webResponse.StatusCode == HttpStatusCode.BadRequest)
                    throw new ContainerNotFoundException("The requested container does not exist");
                if (webResponse.StatusCode == HttpStatusCode.PreconditionFailed)
                    throw new PreconditionFailedException(webException.Message);

                throw;
            }
        }
 public void SetUp()
 {
     createContainer = new PutStorageDirectory("http://storageurl", "containername", "objname");
     mock = new Mock<ICloudFilesRequest>();
     createContainer.Apply(mock.Object);
 }