protected override IHttpResponseAbstraction HandlePut()
        {
            var containerName = GetContainerName(this.Uri.Segments);
            var objectName    = GetObjectName(this.Uri.Segments);

            if (containerName == null && objectName == null)
            {
                return(TestHelper.CreateErrorResponse());
            }

            if (objectName != null)
            {
                var obj = new StorageItem(objectName);
                obj.ProcessMetaDataFromHeaders(this.Headers);
                obj.LoadContent(this.Content);
                this.Objects[obj.Name] = obj;

                var headers = GenerateObjectResponseHeaders(obj);

                return(TestHelper.CreateResponse(HttpStatusCode.Created, headers));
            }
            else
            {
                var container = new StorageItem(containerName);
                container.ProcessMetaDataFromHeaders(this.Headers);

                var containerUpdated = this.Containers.Keys.Any(k => String.Equals(k, container.Name, StringComparison.InvariantCultureIgnoreCase));

                this.Containers[container.Name] = container;

                return(TestHelper.CreateResponse(containerUpdated ? HttpStatusCode.Accepted : HttpStatusCode.Created));
            }
        }
        //public event EventHandler<HttpProgressEventArgs> HttpReceiveProgress;
        //public event EventHandler<HttpProgressEventArgs> HttpSendProgress;

        protected override IHttpResponseAbstraction HandleCopy()
        {
            var containerName = GetContainerName(this.Uri.Segments);
            var objectName = GetObjectName(this.Uri.Segments);

            if (containerName == null && objectName == null)
            {
                return TestHelper.CreateErrorResponse();
            }

            //cannot copy a container
            if (objectName == null)
            {
                return TestHelper.CreateResponse(HttpStatusCode.MethodNotAllowed);
            }

            if (!this.Containers.ContainsKey(containerName))
            {
                return TestHelper.CreateResponse(HttpStatusCode.NotFound);
            }

            if (!this.Headers.ContainsKey("Destination"))
            {
                return TestHelper.CreateResponse(HttpStatusCode.PreconditionFailed);
            }

            if (!this.Objects.ContainsKey(objectName))
            {
                return TestHelper.CreateResponse(HttpStatusCode.NotFound);
            }

            var destination = this.Headers["Destination"];
            var destinationSegs = destination.Split('/');
            if (destinationSegs.Count() < 2)
            {
                return TestHelper.CreateResponse(HttpStatusCode.PreconditionFailed);
            }

            if (destinationSegs[1] == string.Empty)
            {
                return TestHelper.CreateResponse(HttpStatusCode.MethodNotAllowed);
            }

            if (!this.Containers.ContainsKey(destinationSegs[0]))
            {
                return TestHelper.CreateResponse(HttpStatusCode.NotFound);
            }

            var destObjectName = string.Join("", destinationSegs.Skip(1));
            var srcObj = this.Objects[objectName];
            
            var obj = new StorageItem(destObjectName);
            obj.MetaData = srcObj.MetaData;
            obj.ProcessMetaDataFromHeaders(this.Headers);
            var content = new MemoryStream();
            srcObj.Content.CopyTo(content);
            srcObj.Content.Position = 0;
            content.Position = 0;
            obj.Content = content;

            this.Objects[obj.Name] = obj;

            var headers = GenerateObjectResponseHeaders(obj);

            return TestHelper.CreateResponse(HttpStatusCode.Created, headers);

        }
        //public event EventHandler<HttpProgressEventArgs> HttpReceiveProgress;
        //public event EventHandler<HttpProgressEventArgs> HttpSendProgress;

        protected override IHttpResponseAbstraction HandleCopy()
        {
            var containerName = GetContainerName(this.Uri.Segments);
            var objectName    = GetObjectName(this.Uri.Segments);

            if (containerName == null && objectName == null)
            {
                return(TestHelper.CreateErrorResponse());
            }

            //cannot copy a container
            if (objectName == null)
            {
                return(TestHelper.CreateResponse(HttpStatusCode.MethodNotAllowed));
            }

            if (!this.Containers.ContainsKey(containerName))
            {
                return(TestHelper.CreateResponse(HttpStatusCode.NotFound));
            }

            if (!this.Headers.ContainsKey("Destination"))
            {
                return(TestHelper.CreateResponse(HttpStatusCode.PreconditionFailed));
            }

            if (!this.Objects.ContainsKey(objectName))
            {
                return(TestHelper.CreateResponse(HttpStatusCode.NotFound));
            }

            var destination     = this.Headers["Destination"];
            var destinationSegs = destination.Split('/');

            if (destinationSegs.Count() < 2)
            {
                return(TestHelper.CreateResponse(HttpStatusCode.PreconditionFailed));
            }

            if (destinationSegs[1] == string.Empty)
            {
                return(TestHelper.CreateResponse(HttpStatusCode.MethodNotAllowed));
            }

            if (!this.Containers.ContainsKey(destinationSegs[0]))
            {
                return(TestHelper.CreateResponse(HttpStatusCode.NotFound));
            }

            var destObjectName = string.Join("", destinationSegs.Skip(1));
            var srcObj         = this.Objects[objectName];

            var obj = new StorageItem(destObjectName);

            obj.MetaData = srcObj.MetaData;
            obj.ProcessMetaDataFromHeaders(this.Headers);
            var content = new MemoryStream();

            srcObj.Content.CopyTo(content);
            srcObj.Content.Position = 0;
            content.Position        = 0;
            obj.Content             = content;

            this.Objects[obj.Name] = obj;

            var headers = GenerateObjectResponseHeaders(obj);

            return(TestHelper.CreateResponse(HttpStatusCode.Created, headers));
        }
        protected override IHttpResponseAbstraction HandlePut()
        {
            var containerName = GetContainerName(this.Uri.Segments);
            var objectName = GetObjectName(this.Uri.Segments);

            if (containerName == null && objectName == null)
            {
                return TestHelper.CreateErrorResponse();
            }

            if (objectName != null)
            {
                var obj = new StorageItem(objectName);
                obj.ProcessMetaDataFromHeaders(this.Headers);
                obj.LoadContent(this.Content);
                this.Objects[obj.Name] = obj;

                var headers = GenerateObjectResponseHeaders(obj);

                return TestHelper.CreateResponse(HttpStatusCode.Created, headers);
            }
            else
            {
                var container = new StorageItem(containerName);
                container.ProcessMetaDataFromHeaders(this.Headers);

                var containerUpdated = this.Containers.Keys.Any(k => String.Equals(k, container.Name, StringComparison.InvariantCultureIgnoreCase));

                this.Containers[container.Name] = container;

                return TestHelper.CreateResponse(containerUpdated ? HttpStatusCode.Accepted : HttpStatusCode.Created);
            }
        }