• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# request.GenerateRequestByType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



GenerateRequestByType类属于com.mosso.cloudfiles.domain.request命名空间,在下文中一共展示了GenerateRequestByType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: should_be_able_to_return_stream_more_than_once

        public void should_be_able_to_return_stream_more_than_once()
        {
            ICloudFilesResponse getStorageItemResponse = null;
            Stream stream = null;
            Stream streamcopy = null;
            try
            {
                connection.CreateContainer(Constants.CONTAINER_NAME);
                connection.PutStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName);

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

                getStorageItemResponse = new GenerateRequestByType().Submit(getStorageItem, authToken);
                stream = getStorageItemResponse.GetResponseStream();
                streamcopy = getStorageItemResponse.GetResponseStream();
                Assert.AreEqual(stream.Length, streamcopy.Length);
                Assert.Greater(getStorageItemResponse.ContentLength, 0);
                Assert.IsTrue(stream.CanRead);
                Assert.IsTrue(streamcopy.CanRead);
            }
            finally
            {
                if (getStorageItemResponse != null) getStorageItemResponse.Close();
                if (stream != null) stream.Close();
                if (streamcopy != null) streamcopy.Close();
                connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName);
                connection.DeleteContainer(Constants.CONTAINER_NAME);
            }
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:29,代码来源:CloudFileResponseSpec.cs


示例2: Should_return_no_content_when_the_container_exists

 public void Should_return_no_content_when_the_container_exists()
 {
     PutContainer(storageUrl, Constants.CONTAINER_NAME);
     var deleteContainer = new DeleteContainer(storageUrl, Constants.CONTAINER_NAME);
     var response = new GenerateRequestByType().Submit(deleteContainer, authToken);
     Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent));
 }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:7,代码来源:DeleteContainerSpecs.cs


示例3: Should_return_conflict_status_when_the_container_exists_and_is_not_empty

        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);
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:27,代码来源:DeleteContainerSpecs.cs


示例4: 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


示例5: Should_return_created_status_when_the_container_does_not_exist

        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);
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:9,代码来源:PutContainerSpecs.cs


示例6: AddMetadataToItem

 public void AddMetadataToItem(string storageItemName)
 {
     var metadata = new Dictionary<string, string> {{"Test", "test"}, {"Test2", "test2"}};
     var setStorageItemMetaInformation = new SetStorageItemMetaInformation(storageUrl, containerName, storageItemName, metadata);
     var postStorageItemResponse = new GenerateRequestByType().Submit(setStorageItemMetaInformation, authToken);
     Assert.That(postStorageItemResponse.Status, Is.EqualTo(HttpStatusCode.Accepted));
     Assert.That(postStorageItemResponse.Headers["Content-Type"].Contains("text/plain"), Is.True);
     Assert.That(postStorageItemResponse.Headers["Content-Length"], Is.EqualTo("0"));
 }
开发者ID:asw,项目名称:csharp-cloudfiles,代码行数:9,代码来源:TestHelper.cs


示例7: Should_return_created_when_a_stream_is_passed_instead_of_a_file_name

 public void Should_return_created_when_a_stream_is_passed_instead_of_a_file_name()
 {
     using (var testHelper = new TestHelper(authToken, storageUrl))
     {
         var fs = new FileStream(Constants.StorageItemName, FileMode.Open, FileAccess.Read);
         var putStorageItem = new PutStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, fs, null);
         var response = new GenerateRequestByType().Submit(putStorageItem, authToken);
         fs.Close();
         Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
         testHelper.DeleteItemFromContainer();
     }
 }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:12,代码来源:PutStorageItemSpecs.cs


示例8: 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


示例9: should_return_204_no_content_when_the_item_exists

        public void should_return_204_no_content_when_the_item_exists()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer();

                var deleteStorageItem = new DeleteStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName);
                var response = new GenerateRequestByType().Submit(deleteStorageItem,authToken );

                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent));
                Assert.That(response.Headers["Content-Type"].Contains("text/plain"), Is.True);
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:13,代码来源:DeleteContainerItemSpecs.cs


示例10: Should_return_No_Content_status

        public void Should_return_No_Content_status()
        {
            Assert.Ignore("Is returning OK instead of NoContent, need to investigate - 7/14/2010");
            var request = new GetContainers(storageUrl);

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

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


示例11: Connection

        public Connection(UserCredentials userCreds)
        {
            _requestfactory = new GenerateRequestByType();
            callbackFuncs = new List<ProgressCallback>();
            Log.EnsureInitialized();
            AuthToken = "";
            StorageUrl = "";
            if (userCreds == null) throw new ArgumentNullException("userCredentials");

            _usercreds = userCreds;

            VerifyAuthentication();
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:13,代码来源:Connection.cs


示例12: Should_return_created_as_status_when_the_file_does_not_already_exist

        public void Should_return_created_as_status_when_the_file_does_not_already_exist()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                var putStorageItem = new PutStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName);

               // Assert.That(putStorageItem.ContentLength, Is.EqualTo(34)); //does not belong in this test

                var response = new GenerateRequestByType().Submit(putStorageItem, authToken);
                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
                Assert.That(response.Headers[Constants.ETAG], Is.EqualTo(response.ETag));
                testHelper.DeleteItemFromContainer();
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:14,代码来源:PutStorageItemSpecs.cs


示例13: 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


示例14: 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


示例15: Should_return_accepted_when_meta_information_is_supplied

        public void Should_return_accepted_when_meta_information_is_supplied()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer();

                Dictionary<string, string> metadata = new Dictionary<string, string>();
                metadata.Add("Test", "test");
                metadata.Add("Test2", "test2");

                SetStorageItemMetaInformation setStorageItemMetaInformation = new SetStorageItemMetaInformation(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, metadata);

                var metaInformationResponse = new GenerateRequestByType().Submit(setStorageItemMetaInformation, authToken);

                Assert.That(metaInformationResponse.Status, Is.EqualTo(HttpStatusCode.Accepted));
                testHelper.DeleteItemFromContainer();
            }
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:18,代码来源:SetStorageItemMetaInformationSpecs.cs


示例16: 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


示例17: 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


示例18: 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


示例19: Should_throw_an_exception_when_the_container_name_exceeds_the_maximum_length

        public void Should_throw_an_exception_when_the_container_name_exceeds_the_maximum_length()
        {
            string containerName = new string('a', Constants.MaximumContainerNameLength + 1);
            try
            {
                using (new TestHelper(authToken, storageUrl, containerName))
                {
                    var putStorageItem = new PutStorageItem(storageUrl, containerName, 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("ContainerNameException expected");
            }
            catch (Exception ex)
            {
                Assert.That(ex, Is.TypeOf(typeof (ContainerNameException)));
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:20,代码来源:DeleteContainerSpecs.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# api.Session类代码示例发布时间:2022-05-26
下一篇:
C# Model.Member类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap