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


C# SearchClient.SearchCode方法代码示例

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


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

示例1: TestingTheRepoQualifier

            public void TestingTheRepoQualifier()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.Repo = "octokit.net";

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+repo:octokit.net"));
            }
开发者ID:nsavga,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs

示例2: TestingTheRepoAndPathAndExtensionQualifiers

            public void TestingTheRepoAndPathAndExtensionQualifiers()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.Repo = "octokit.net";
                request.Path = "tools/FAKE.core";
                request.Extension = "fs";

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => 
                        d["q"] == "something+path:tools/FAKE.core+extension:fs+repo:octokit.net"));
            }
开发者ID:nsavga,项目名称:octokit.net,代码行数:16,代码来源:SearchClientTests.cs

示例3: TestingTheLanguageQualifier

            public void TestingTheLanguageQualifier()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.Language = Language.CSharp;

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+language:C#"));
            }
开发者ID:nsavga,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs

示例4: TestingTheSizeQualifier_Range

            public void TestingTheSizeQualifier_Range()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.Size = new Range(10, 100);

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+size:10..100"));
            }
开发者ID:nsavga,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs

示例5: TestingTheDefaultOrderParameter

            public void TestingTheDefaultOrderParameter()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["order"] == "desc"));
            }
开发者ID:nsavga,项目名称:octokit.net,代码行数:12,代码来源:SearchClientTests.cs

示例6: TestingTheInQualifier_Multiple

            public void TestingTheInQualifier_Multiple()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.In = new[] { CodeInQualifier.File, CodeInQualifier.Path };

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+in:file,path"));
            }
开发者ID:nsavga,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs

示例7: EnsuresNonNullArguments

 public void EnsuresNonNullArguments()
 {
     var client = new SearchClient(Substitute.For<IApiConnection>());
     Assert.Throws<ArgumentNullException>(() => client.SearchCode(null));
 }
开发者ID:nsavga,项目名称:octokit.net,代码行数:5,代码来源:SearchClientTests.cs

示例8: TestingTheOrderParameter

            public void TestingTheOrderParameter()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.SortField = CodeSearchSort.Indexed;
                request.Order = SortDirection.Ascending;

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d =>
                        d["sort"] == "indexed" &&
                        d["order"] == "asc"));
            }
开发者ID:nsavga,项目名称:octokit.net,代码行数:16,代码来源:SearchClientTests.cs

示例9: ErrorOccursWhenSpecifyingInvalidFormatForRepos

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

                var request = new SearchCodeRequest("windows");
                request.Repos = new RepositoryCollection {
                    "haha-business"
                };

                request.Order = SortDirection.Descending;

                await Assert.ThrowsAsync<RepositoryFormatException>(
                    async () => await client.SearchCode(request));
            }
开发者ID:naveensrinivasan,项目名称:octokit.net,代码行数:15,代码来源:SearchClientTests.cs

示例10: RequestsTheCorrectUrl

 public void RequestsTheCorrectUrl()
 {
     var connection = Substitute.For<IApiConnection>();
     var client = new SearchClient(connection);
     client.SearchCode(new SearchCodeRequest("something"));
     connection.Received().Get<SearchCodeResult>(
         Arg.Is<Uri>(u => u.ToString() == "search/code"),
         Arg.Any<Dictionary<string, string>>());
 }
开发者ID:nsavga,项目名称:octokit.net,代码行数:9,代码来源:SearchClientTests.cs

示例11: TestingTheFileNameQualifier

            public void TestingTheFileNameQualifier()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.FileName = "packages.config";

                client.SearchCode(request);

                connection.Received().Get<SearchCodeResult>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+filename:packages.config"));
            }
开发者ID:naveensrinivasan,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs

示例12: EnsuresNonNullArguments

 public async Task EnsuresNonNullArguments()
 {
     var client = new SearchClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentNullException>(() => client.SearchCode(null));
 }
开发者ID:naveensrinivasan,项目名称:octokit.net,代码行数:5,代码来源:SearchClientTests.cs

示例13: TestingTheUserQualifier

            public void TestingTheUserQualifier()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.User = "alfhenrik";

                client.SearchCode(request);

                connection.Received().GetAll<SearchCode>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+user:alfhenrik"));
            }
开发者ID:pgarbe,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs

示例14: TestingTheSizeQualifier_LessThanOrEqual

            public void TestingTheSizeQualifier_LessThanOrEqual()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.Size = Range.LessThanOrEquals(10);

                client.SearchCode(request);

                connection.Received().GetAll<SearchCode>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+size:<=10"));
            }
开发者ID:pgarbe,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs

示例15: TestingTheSortParameter

            public void TestingTheSortParameter()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchCodeRequest("something");
                request.SortField = CodeSearchSort.Indexed;

                client.SearchCode(request);

                connection.Received().GetAll<SearchCode>(
                    Arg.Is<Uri>(u => u.ToString() == "search/code"),
                    Arg.Is<Dictionary<string, string>>(d => d["sort"] == "indexed"));
            }
开发者ID:pgarbe,项目名称:octokit.net,代码行数:13,代码来源:SearchClientTests.cs


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