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


C# Octokit.GistsClient类代码示例

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


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

示例1: PostsToTheCorrectUrl

        public void PostsToTheCorrectUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            var updateGist = new GistUpdate();
            updateGist.Description = "my newly updated gist";
            var gistFileUpdate = new GistFileUpdate 
            { 
                NewFileName = "myNewGistTestFile.cs",
                Content = "new GistsClient(connection).Edit();"
            };

            updateGist.Files.Add("myGistTestFile.cs", gistFileUpdate);

            client.Edit("1", updateGist);

            connection.Received().Patch<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists/1"), Arg.Any<object>());
        }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:19,代码来源:GistsClientTests.cs

示例2: RequestsCorrectGetAllUrl

        public void RequestsCorrectGetAllUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            client.GetAll();
            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), Args.ApiOptions);
        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:8,代码来源:GistsClientTests.cs

示例3: RequestsCorrectUrl

        public void RequestsCorrectUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            client.Get("1");

            connection.Received().Get<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists/1"), null);
        }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:9,代码来源:GistsClientTests.cs

示例4: RequestsCorrectGetAllWithSinceUrl

        public void RequestsCorrectGetAllWithSinceUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);
            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAll(since);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), 
                Arg.Is<IDictionary<string,string>>(x => x.ContainsKey("since")));
        }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:10,代码来源:GistsClientTests.cs

示例5: RequestsCorrectGetAllWithSinceUrl

        public void RequestsCorrectGetAllWithSinceUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAll(since);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"),
        DictionaryWithSince, Args.ApiOptions);
        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:11,代码来源:GistsClientTests.cs

示例6: RequestsCorrectGetAllUrlWithApiOptions

        public void RequestsCorrectGetAllUrlWithApiOptions()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            var options = new ApiOptions
            {
                PageSize = 1,
                PageCount = 1,
                StartPage = 1
            };

            client.GetAll(options);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), options);

        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:17,代码来源:GistsClientTests.cs

示例7: GitHubClient

        /// <summary>
        /// Create a new instance of the GitHub API v3 client using the specified connection.
        /// </summary>
        /// <param name="connection">The underlying <seealso cref="IConnection"/> used to make requests</param>
        public GitHubClient(IConnection connection)
        {
            Ensure.ArgumentNotNull(connection, "connection");

            Connection = connection;
            var apiConnection = new ApiConnection(connection);
            Authorization = new AuthorizationsClient(apiConnection);
            Activity = new ActivitiesClient(apiConnection);
            Blob = new BlobsClient(apiConnection);
            Issue = new IssuesClient(apiConnection);
            Miscellaneous = new MiscellaneousClient(connection);
            Notification = new NotificationsClient(apiConnection);
            Organization = new OrganizationsClient(apiConnection);
            Repository = new RepositoriesClient(apiConnection);
            Gist = new GistsClient(apiConnection);
            Release = new ReleasesClient(apiConnection);
            User = new UsersClient(apiConnection);
            SshKey = new SshKeysClient(apiConnection);
            GitDatabase = new GitDatabaseClient(apiConnection);
            Tree = new TreesClient(apiConnection);
        }
开发者ID:richardkundl,项目名称:octokit.net,代码行数:25,代码来源:GitHubClient.cs

示例8: ThrowsExceptionForInvalidStatusCode

        public async Task ThrowsExceptionForInvalidStatusCode()
        {
            var response = Task.Factory.StartNew<IResponse<object>>(() =>
                new ApiResponse<object> { StatusCode = HttpStatusCode.Conflict });
            var connection = Substitute.For<IConnection>();
            connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "gists/1/star"),
                null, null).Returns(response);
            var apiConnection = Substitute.For<IApiConnection>();
            apiConnection.Connection.Returns(connection);

            var client = new GistsClient(apiConnection);

            await AssertEx.Throws<ApiException>(async () => await client.IsStarred("1"));
        }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:14,代码来源:GistsClientTests.cs

示例9: RequestsCorrectUnstarUrl

        public void RequestsCorrectUnstarUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            client.Unstar("1");

            connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "gists/1/star"));
        }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:9,代码来源:GistsClientTests.cs

示例10: RequestsCorrectGetCommitsUrl

        public void RequestsCorrectGetCommitsUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            client.GetAllCommits("9257657");

            connection.Received().GetAll<GistHistory>(Arg.Is<Uri>(u => u.ToString() == "gists/9257657/commits"), Args.ApiOptions);
        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:9,代码来源:GistsClientTests.cs

示例11: EnsureNonNullArguments

        public async Task EnsureNonNullArguments()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForUser(null));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForUser(""));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForUser("", DateTimeOffset.Now));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForUser("", DateTimeOffset.Now, ApiOptions.None));
            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForUser("user", DateTimeOffset.Now, null));
        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:11,代码来源:GistsClientTests.cs

示例12: EnsuresArgumentsNotNull

        public async Task EnsuresArgumentsNotNull()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            Assert.Throws<ArgumentNullException>(() => client.Delete(null));
        }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:7,代码来源:GistsClientTests.cs

示例13: RequestsCorrectGetAllWithSinceUrlAndApiOptions

        public void RequestsCorrectGetAllWithSinceUrlAndApiOptions()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            var options = new ApiOptions
            {
                PageSize = 1,
                PageCount = 1,
                StartPage = 1
            };
            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAll(since, options);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"),
                DictionaryWithSince, options);

        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:18,代码来源:GistsClientTests.cs

示例14: EnsureNonNullArguments

        public async Task EnsureNonNullArguments()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllCommits(null));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllCommits(""));

            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForks(null));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForks(""));
        }
开发者ID:LiyeXu,项目名称:octokit.net,代码行数:11,代码来源:GistsClientTests.cs

示例15: RequestsCorrectValueForStatusCode

        public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
        {
            var response = Task.Factory.StartNew<IResponse<object>>(() =>
                new ApiResponse<object> { StatusCode = status });
            var connection = Substitute.For<IConnection>();
            connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "gists/1/star"),
                null, null).Returns(response);
            var apiConnection = Substitute.For<IApiConnection>();
            apiConnection.Connection.Returns(connection);
            var client = new GistsClient(apiConnection);

            var result = await client.IsStarred("1");

            Assert.Equal(expected, result);
        }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:15,代码来源:GistsClientTests.cs


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