当前位置: 首页>>代码示例>>C#>>正文


C# GenerateRequestByType.Dispose方法代码示例

本文整理汇总了C#中com.mosso.cloudfiles.domain.request.GenerateRequestByType.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# GenerateRequestByType.Dispose方法的具体用法?C# GenerateRequestByType.Dispose怎么用?C# GenerateRequestByType.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mosso.cloudfiles.domain.request.GenerateRequestByType的用法示例。


在下文中一共展示了GenerateRequestByType.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: should_not_throw_an_exception_when_the_container_name_starts_with_pound

        public void should_not_throw_an_exception_when_the_container_name_starts_with_pound()
        {
            var getContainerItemList = new GetContainerItemList(storageUrl, "#container");

            var response = new GenerateRequestByType().Submit(getContainerItemList, authToken);
            response.Dispose();
            Assert.That(true);
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:8,代码来源:GetContainerItemListSpecs.cs

示例2: should_not_throw_an_exception_when_the_container_contains_utf8_characters_3

        public void should_not_throw_an_exception_when_the_container_contains_utf8_characters_3()
        {
            var containerName = '\uDCFF' + "container";
            var getContainerItemList = new GetContainerItemList(storageUrl,  containerName);

            var response = new GenerateRequestByType().Submit(getContainerItemList, authToken);

            response.Dispose();
            foreach (string s in response.ContentBody)
                Console.WriteLine(s);
            Assert.That(true);
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:12,代码来源:GetContainerItemListSpecs.cs

示例3: Should_get_serialized_json_format

        public void Should_get_serialized_json_format()
        {
            var testHelper = new TestHelper(authToken, storageUrl);
            testHelper.PutItemInContainer(Constants.StorageItemNameJpg);
            var getContainerInformation = new GetContainerInformationSerialized(storageUrl,  Constants.CONTAINER_NAME, Format.JSON);

            var jsonResponse = new GenerateRequestByType().Submit(getContainerInformation, authToken);
            Assert.That(jsonResponse.Status, Is.EqualTo(HttpStatusCode.OK));
            var jsonReturnValue = String.Join("", jsonResponse.ContentBody.ToArray());
            jsonResponse.Dispose();
            var expectedSubString = "[{\"name\":[ ]?\"" + Constants.StorageItemNameJpg + "\",[ ]?\"hash\":[ ]?\"b44a59383b3123a747d139bd0e71d2df\",[ ]?\"bytes\":[ ]?\\d+,[ ]?\"content_type\":[ ]?\"image.*jpeg\",[ ]?\"last_modified\":[ ]?\"" + String.Format("{0:yyyy-MM}", DateTime.Now);

            Assert.That(Regex.Match(jsonReturnValue, expectedSubString).Success, Is.True);
            testHelper.DeleteItemFromContainer(Constants.StorageItemNameJpg);
            testHelper.Dispose();
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:16,代码来源:GetContainerInformationSpecs.cs

示例4: Should_get_serialized_xml_format

        public void Should_get_serialized_xml_format()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer(Constants.StorageItemNameJpg);
                var getContainerInformation = new GetContainerInformationSerialized(storageUrl,  Constants.CONTAINER_NAME, Format.XML);

                var xmlResponse = new GenerateRequestByType().Submit(getContainerInformation, authToken);
                Assert.That(xmlResponse.Status, Is.EqualTo(HttpStatusCode.OK));
                var xmlReturnValue = String.Join("", xmlResponse.ContentBody.ToArray());
                xmlResponse.Dispose();
                var expectedSubString = "<container name=\"" + Constants.CONTAINER_NAME + "\"><object><name>" + Constants.StorageItemNameJpg + "<\\/name><hash>b44a59383b3123a747d139bd0e71d2df<\\/hash><bytes>\\d+<\\/bytes><content_type>image.*jpeg<\\/content_type><last_modified>" + String.Format("{0:yyyy-MM}", DateTime.Now);

                Assert.That(Regex.Match(xmlReturnValue, expectedSubString).Success || string.IsNullOrEmpty(xmlReturnValue), Is.True);
                testHelper.DeleteItemFromContainer(Constants.StorageItemNameJpg);
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:17,代码来源:GetContainerInformationSpecs.cs

示例5: Should_return_the_list_of_containers

        public void Should_return_the_list_of_containers()
        {
            using (new TestHelper(authToken, storageUrl))
            {
                ICloudFilesResponse response = null;
                try
                {
                    GetContainers request = new GetContainers(storageUrl);
                    response = new GenerateRequestByType().Submit(request, authToken);
                    Assert.That(response.ContentBody.Count, Is.GreaterThan(0));

                }
                finally
                {
                    if (response != null)
                        response.Dispose();
                }
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:19,代码来源:GetContainersSpecs.cs

示例6: should_not_throw_an_exception_when_the_container_contains_utf8_characters_3

        public void should_not_throw_an_exception_when_the_container_contains_utf8_characters_3()
        {
            var containerName = '\uDCFF' + "container" + new Guid();

            try
            {
                connection.CreateContainer(containerName);
                var getContainerItemList = new GetContainerItemList(storageUrl, containerName);

                var response = new GenerateRequestByType().Submit(getContainerItemList, authToken);

                response.Dispose();
                Assert.That(true);
            }
            finally
            {
                connection.DeleteContainer(containerName);
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:19,代码来源:GetContainerItemListSpecs.cs

示例7: Should_return_ok_if_the_item_exists

        public void Should_return_ok_if_the_item_exists()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                ICloudFilesResponse getStorageItemResponse = null;
                try
                {
                    testHelper.PutItemInContainer();
                    var getStorageItem = new GetStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, requestHeaderFields);

                    getStorageItemResponse = new GenerateRequestByType().Submit(getStorageItem, authToken);
                    Assert.That(getStorageItemResponse.Status, Is.EqualTo(HttpStatusCode.OK));
                }
                finally
                {
                    if (getStorageItemResponse != null) getStorageItemResponse.Dispose();
                    testHelper.DeleteItemFromContainer();
                }
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:20,代码来源:GetStorageItemSpecs.cs

示例8: Should_return_OK_status

        public void Should_return_OK_status()
        {
            using(new TestHelper(authToken, storageUrl))
            {
                ICloudFilesResponse response = null;
                try
                {
                    GetContainers request = new GetContainers(storageUrl);

                    response = new GenerateRequestByType(new RequestFactoryWithAgentSupport("NASTTestUserAgent")).Submit(request, authToken);

                    Assert.That(response.Status, Is.EqualTo(HttpStatusCode.OK));
                    Assert.That(response.ContentBody, Is.Not.Null);
                }
                finally
                {
                    if(response != null)
                        response.Dispose();
                }
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:21,代码来源:GetContainersSpecs.cs

示例9: should_return_a_list_of_items_when_container_is_not_empty

        public void should_return_a_list_of_items_when_container_is_not_empty()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer(Constants.StorageItemName, Constants.StorageItemName);

                var getContainerItemsRequest = new GetContainerItemList(storageUrl,  Constants.CONTAINER_NAME);
                //getContainerItemsRequest.UserAgent = Constants.USER_AGENT;

                var response = new GenerateRequestByType().Submit(getContainerItemsRequest, authToken);
                testHelper.DeleteItemFromContainer(Constants.StorageItemName);

                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.OK));
                Assert.That(response.ContentType, Is.Not.Null);
                response.Dispose();
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:17,代码来源:GetContainerItemListSpecs.cs

示例10: Should_return_412_precondition_failed_if_the_item_exists_and_has_been_modified_since_designated_time

        public void Should_return_412_precondition_failed_if_the_item_exists_and_has_been_modified_since_designated_time()
        {
            requestHeaderFields = new Dictionary<RequestHeaderFields, string>
            {{RequestHeaderFields.IfUnmodifiedSince, pastDateTime.ToString()}};

            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                ICloudFilesResponse getStorageItemResponse = null;
                var exceptionWasThrown = false;
                try
                {
                    testHelper.PutItemInContainer();
                    testHelper.PutItemInContainer();
                    var getStorageItem = new GetStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, requestHeaderFields);

                    getStorageItemResponse = new GenerateRequestByType().Submit(getStorageItem, authToken);
                    Assert.That(getStorageItemResponse.Status, Is.EqualTo(HttpStatusCode.OK));
                }
                catch (WebException ex)
                {
                    var response = (HttpWebResponse)ex.Response;
                    Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.PreconditionFailed));
                    exceptionWasThrown = true;
                }
                finally
                {
                    if (getStorageItemResponse != null) getStorageItemResponse.Dispose();
                    testHelper.DeleteItemFromContainer();
                }

                Assert.That(exceptionWasThrown, Is.True);
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:33,代码来源:GetStorageItemSpecs.cs

示例11: should_not_throw_an_exception_when_the_container_name_starts_with_pound

        public void should_not_throw_an_exception_when_the_container_name_starts_with_pound()
        {
            var containerName = "#container" + new Guid();

            try
            {
                connection.CreateContainer(containerName);
                var getContainerItemList = new GetContainerItemList(storageUrl, containerName);

                var response = new GenerateRequestByType().Submit(getContainerItemList, authToken);
                response.Dispose();
                Assert.That(true);
            }
            finally
            {
                if(connection.GetContainers().Contains(containerName))
                    connection.DeleteContainer(containerName);
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:19,代码来源:GetContainerItemListSpecs.cs

示例12: should_return_empty_brackets_and_ok_status_200

        public void should_return_empty_brackets_and_ok_status_200()
        {
            var getAccountInformationJson = new GetAccountInformationSerialized(storageUrl,  Format.JSON);
            var getAccountInformationJsonResponse = new GenerateRequestByType().Submit(getAccountInformationJson, authToken);
            Assert.That(getAccountInformationJsonResponse.Status, Is.EqualTo(HttpStatusCode.OK));
            var contentBody = String.Join("",getAccountInformationJsonResponse.ContentBody.ToArray());
            getAccountInformationJsonResponse.Dispose();

            Assert.That(contentBody, Is.EqualTo("[]"));
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:10,代码来源:GetAccountInformationSpecs.cs

示例13: should_return_account_name_and_ok_status_200

        public void should_return_account_name_and_ok_status_200()
        {
            var accountInformationXml = new GetAccountInformationSerialized(storageUrl, Format.XML);
            var getAccountInformationXmlResponse =new GenerateRequestByType().Submit(accountInformationXml, authToken);
            Assert.That(getAccountInformationXmlResponse.Status, Is.EqualTo(HttpStatusCode.OK));

            var contentBody = "";
            foreach (var s in getAccountInformationXmlResponse.ContentBody)
            {
                contentBody += s;
            }

            getAccountInformationXmlResponse.Dispose();
            const string expectedSubString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><account name=\"MossoCloudFS_5d8f3dca-7eb9-4453-aa79-2eea1b980353\"></account>";
            Assert.That(contentBody, Is.EqualTo(expectedSubString));
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:16,代码来源:GetAccountInformationSpecs.cs

示例14: should_return_item_with_last_modified_date_within_a_minute_of_object_creation

        public void should_return_item_with_last_modified_date_within_a_minute_of_object_creation()
        {
            requestHeaderFields = new Dictionary<RequestHeaderFields, string>
            {{RequestHeaderFields.IfModifiedSince, pastDateTime.ToString()}};

            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                ICloudFilesResponse getStorageItemResponse = null;
                try
                {
                    testHelper.PutItemInContainer();
                    var getStorageItem = new GetStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, requestHeaderFields);

                    getStorageItemResponse = new GenerateRequestByType().Submit(getStorageItem, authToken);
                    Assert.That(getStorageItemResponse.Status, Is.EqualTo(HttpStatusCode.OK));
                    Assert.That(getStorageItemResponse.LastModified, Is.AtLeast(DateTime.Now.AddMinutes(-1)));
                    Assert.That(getStorageItemResponse.LastModified, Is.AtMost(DateTime.Now.AddMinutes(2)));
                }
                finally
                {
                    if (getStorageItemResponse != null) getStorageItemResponse.Dispose();
                    testHelper.DeleteItemFromContainer();
                }
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:25,代码来源:GetStorageItemSpecs.cs

示例15: Should_return_partial_content_if_the_item_exists_and_only_range_from_is_set

        public void Should_return_partial_content_if_the_item_exists_and_only_range_from_is_set()
        {
            requestHeaderFields.Add(RequestHeaderFields.Range, "10-");
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                ICloudFilesResponse getStorageItemResponse = null;
                try
                {
                    testHelper.PutItemInContainer();

                    var getStorageItem = new GetStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, requestHeaderFields);

                    getStorageItemResponse = new GenerateRequestByType().Submit(getStorageItem, authToken);
                    Assert.That(getStorageItemResponse.Status, Is.EqualTo(HttpStatusCode.PartialContent));
                }
                finally
                {
                    if (getStorageItemResponse != null) getStorageItemResponse.Dispose();
                    testHelper.DeleteItemFromContainer();
                }
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:22,代码来源:GetStorageItemSpecs.cs


注:本文中的com.mosso.cloudfiles.domain.request.GenerateRequestByType.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。