Beispiel #1
0
        private void CreateContainer()
        {
            var createContainer      = new CreateContainer(storageUrl, containerName);
            var putContainerResponse = new GenerateRequestByType().Submit(createContainer, authToken);

            Assert.That(putContainerResponse.Status, Is.EqualTo(HttpStatusCode.Created));
        }
        public void Should_return_created_status_when_the_container_does_not_exist()
        {
            CreateContainer createContainer = new CreateContainer(storageUrl, authToken, Constants.CONTAINER_NAME);

            IResponse response = new ResponseFactory<CloudFilesResponse>().Create(new CloudFilesRequest(createContainer));
            Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));

            DeleteContainer(storageUrl, Constants.CONTAINER_NAME);
        }
        public void Should_return_created_status_when_the_container_does_not_exist()
        {
            CreateContainer createContainer = new CreateContainer(storageUrl, Constants.CONTAINER_NAME);

            IResponse response = new GenerateRequestByType( ).Submit(createContainer, authToken);
            Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));

            DeleteContainer(storageUrl, Constants.CONTAINER_NAME);
        }
        public void when_creating_a_container()
        {
            var createContainer = new CreateContainer("http://storageurl", "containername");
            var mock = new Mock<ICloudFilesRequest>();
            createContainer.Apply(mock.Object);

            should("append container name to storage url",()=>createContainer.CreateUri().ToString().Is("http://storageurl/containername"));
            should("use PUT method", () =>
                mock.VerifySet(x => x.Method = "PUT")
                );
        }
        private void PutContainer(string storageUri, String containerName)
        {
            var createContainer = new CreateContainer(storageUri, authToken, containerName);

            IResponse response = new ResponseFactory<CloudFilesResponse>().Create(new CloudFilesRequest(createContainer));
            Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
        }
 void containercreation(string containername)
 {
     var createContainer = new CreateContainer(StorageUrl, containername);
     //   var createContainerResponse = _responseFactory.Create(new CloudFilesRequest(createContainer, UserCredentials.ProxyCredentials));
     var createContainerResponse = _requestfactory.Submit(createContainer, AuthToken);
     if (createContainerResponse.Status == HttpStatusCode.Accepted)
         throw new ContainerAlreadyExistsException("The container already exists");
 }
 protected override void SetupContext()
 {
     createContainer = new CreateContainer("http://storageurl", "containername");
     mock = new Mock<ICloudFilesRequest>();
     createContainer.Apply(mock.Object);
 }
 public void setup()
 {
     createContainer = new CreateContainer("http://storageurl", "authtoken", "containername");
 }
 private void CreateContainer()
 {
     var createContainer = new CreateContainer(storageUrl, containerName);
     var putContainerResponse = new GenerateRequestByType().Submit(createContainer, authToken);
     Assert.That(putContainerResponse.Status, Is.EqualTo(HttpStatusCode.Created));
 }
        /// <summary>
        /// This method is used to create a container on cloudfiles with a given name
        /// </summary>
        /// <example>
        /// <code>
        /// UserCredentials userCredentials = new UserCredentials("username", "api key");
        /// IConnection connection = new Connection(userCredentials);
        /// connection.CreateContainer("container name");
        /// </code>
        /// </example>
        /// <param name="containerName">The desired name of the container</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the reference parameters are null</exception>
        public void CreateContainer(string containerName)
        {
            try
            {
                if (string.IsNullOrEmpty(containerName))
                    throw new ArgumentNullException();

                Log.Info(this, "Creating container '" + containerName + "' for user " + UserCredentials.Username);

                var createContainer = new CreateContainer(StorageUrl, AuthToken, containerName);
                var createContainerResponse = new ResponseFactory<CloudFilesResponse>().Create(new CloudFilesRequest(createContainer, UserCredentials.ProxyCredentials));
                if (createContainerResponse.Status == HttpStatusCode.Accepted)
                    throw new ContainerAlreadyExistsException("The container already exists");
            }
            catch(Exception ex)
            {
                Log.Error(this, "Error creating container '"
                    + containerName + "' for user "
                    + UserCredentials.Username, ex);
                throw;
            }
        }
        private void PutContainer(string storageUri, String containerName)
        {
            var createContainer = new CreateContainer(storageUri, containerName);

            IResponse response = new GenerateRequestByType().Submit(createContainer, authToken);
            Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
        }
Beispiel #12
0
 private void ContainerCreation(string containername)
 {
     var createContainer = new CreateContainer(StorageUrl, containername);
     var createContainerResponse = _requestfactory.Submit(createContainer, AuthToken);
     if (createContainerResponse.Status == HttpStatusCode.Accepted)
         throw new ContainerAlreadyExistsException("The container already exists");
 }
 private void CreateContainer()
 {
     var createContainer = new CreateContainer(storageUrl, authToken, containerName);
     var putContainerResponse = new ResponseFactory<CloudFilesResponse>().Create(new CloudFilesRequest(createContainer));
     Assert.That(putContainerResponse.Status, Is.EqualTo(HttpStatusCode.Created));
 }