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


C# RestClient.Posts方法代码示例

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


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

示例1: Query_PassQuery_CorrectlyAppendsQueryString

        public async Task Query_PassQuery_CorrectlyAppendsQueryString()
        {
            dynamic client = new RestClient(BaseUri);

            List<Post> posts = await client.Posts().Query(new { id = 2 }).Get();

            Assert.That(posts.Count, Is.EqualTo(1));
            Assert.That(posts[0].id, Is.EqualTo(2));
        }
开发者ID:tsteele,项目名称:DalSoft.RestClient,代码行数:9,代码来源:RestClientTests.cs

示例2: Delete_DeletePostUsingResourceMethod_HttpResponseMessageReturnsOK

        public async Task Delete_DeletePostUsingResourceMethod_HttpResponseMessageReturnsOK()
        {
            dynamic client = new RestClient(BaseUri);
            var result = await client.Posts().Resource(1).Delete();

            Assert.That(result.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
开发者ID:tsteele,项目名称:DalSoft.RestClient,代码行数:7,代码来源:RestClientTests.cs

示例3: Put_UpdatePostWithStaticType_UpdatesAndReturnsNewResourceAsStaticType

        public async Task Put_UpdatePostWithStaticType_UpdatesAndReturnsNewResourceAsStaticType()
        {
            dynamic client = new RestClient(BaseUri);
            var post = new Post { title = "foo", body = "bar", userId = 10 };
            var result = await client.Posts(1).Put(post);

            Assert.That(result.title, Is.EqualTo(post.title));
            Assert.That(result.body, Is.EqualTo(post.body));
            Assert.That(result.userId, Is.EqualTo(post.userId));
            Assert.That(result.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
开发者ID:tsteele,项目名称:DalSoft.RestClient,代码行数:11,代码来源:RestClientTests.cs

示例4: Get_NestedCommentsFromPost_GetsCommentCorrectly

        public async Task Get_NestedCommentsFromPost_GetsCommentCorrectly()
        {
            dynamic client = new RestClient(BaseUri);

            List<Post> post = await client.Posts(2).Comments.Get();

            Assert.That(post.First().id, Is.EqualTo(6));
        }
开发者ID:tsteele,项目名称:DalSoft.RestClient,代码行数:8,代码来源:RestClientTests.cs

示例5: Get_SinglePostSynchronously_GetsPostCorrectly

        public void Get_SinglePostSynchronously_GetsPostCorrectly()
        {
            dynamic client = new RestClient(BaseUri);

            HttpResponseMessage httpResponseMessage = client.Posts(1).Get().Result;

            Assert.That(httpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
开发者ID:tsteele,项目名称:DalSoft.RestClient,代码行数:8,代码来源:RestClientTests.cs

示例6: Get_SinglePostUsingInlineMethod_GetsPostCorrectly

        public async Task Get_SinglePostUsingInlineMethod_GetsPostCorrectly()
        {
            dynamic client = new RestClient(BaseUri);

            HttpResponseMessage httpResponseMessage = await client.Posts(1).Get();

            Assert.That(httpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
开发者ID:tsteele,项目名称:DalSoft.RestClient,代码行数:8,代码来源:RestClientTests.cs


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