示例#1
0
        public void Should_return_conflict_status_when_the_container_exists_and_is_not_empty()
        {
            try
            {
                using (new TestHelper(authToken, storageUrl))
                {
                    var putStorageItem = new PutStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName);

                    //   Assert.That(putStorageItem.ContentLength, Is.GreaterThan(0));

                    var putStorageItemResponse = new GenerateRequestByType().Submit(putStorageItem, authToken);
                    Assert.That(putStorageItemResponse.Status, Is.EqualTo(HttpStatusCode.Created));
                }
                Assert.Fail("409 conflict expected");
            }
            catch (WebException we)
            {
                var response = (HttpWebResponse)we.Response;
                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Conflict));
            }
            finally
            {
                var genrequest = new GenerateRequestByType();
                genrequest.Submit(new DeleteStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName), authToken);
                genrequest.Submit(new DeleteContainer(storageUrl, Constants.CONTAINER_NAME), authToken);
            }
        }
        public void Should_get_204_response_when_authenticated_correctly()
        {
            IResponse response = factory.Submit(request);

            Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent));
        }