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

C# SearchClient类代码示例

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

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



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

示例1: RequestsTheCorrectUrl

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


示例2: RequestsTheCorrectUrl

 public void RequestsTheCorrectUrl()
 {
     var connection = Substitute.For<IApiConnection>();
     var client = new SearchClient(connection);
     client.SearchRepo(new SearchRepositoriesRequest("something"));
     connection.Received().GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"), Arg.Any<Dictionary<string, string>>());
 }
开发者ID:rgmills,项目名称:octokit.net,代码行数:7,代码来源:SearchClientTests.cs


示例3: BuildClient

        /// <summary>
        /// Build and initialize an IdmNet Client object ready for use
        /// </summary>
        /// <returns>Newly initialized IdmNet Client</returns>
        public static IdmNetClient BuildClient()
        {
            var soapBinding = new IdmSoapBinding();
            string fqdn = GetEnvironmentSetting("MIM_fqdn");
            var endpointIdentity = EndpointIdentity.CreateSpnIdentity("FIMSERVICE/" + fqdn);

            var enumerationPath = "http://" + fqdn + SoapConstants.EnumeratePortAndPath;
            var factoryPath = "http://" + fqdn + SoapConstants.FactoryPortAndPath;
            var resourcePath = "http://" + fqdn + SoapConstants.ResourcePortAndPath;

            var enumerationEndpoint = new EndpointAddress(new Uri(enumerationPath), endpointIdentity);
            var factoryEndpoint = new EndpointAddress(new Uri(factoryPath), endpointIdentity);
            var resourceEndpoint = new EndpointAddress(new Uri(resourcePath), endpointIdentity);

            var searchClient = new SearchClient(soapBinding, enumerationEndpoint);
            var factoryClient = new ResourceFactoryClient(soapBinding, factoryEndpoint);
            var resourceClient = new ResourceClient(soapBinding, resourceEndpoint);

            var credentials = new NetworkCredential(
                GetEnvironmentSetting("MIM_username"),
                GetEnvironmentSetting("MIM_pwd"),
                GetEnvironmentSetting("MIM_domain"));

            searchClient.ClientCredentials.Windows.ClientCredential = credentials;
            factoryClient.ClientCredentials.Windows.ClientCredential = credentials;
            resourceClient.ClientCredentials.Windows.ClientCredential = credentials;

            var it = new IdmNetClient(searchClient, factoryClient, resourceClient);
            return it;
        }
开发者ID:sunmorgus,项目名称:ms-idm-net,代码行数:34,代码来源:IdmNetClientFactory.cs


示例4: TestingTheTermParameter

 public void TestingTheTermParameter()
 {
     var connection = Substitute.For<IApiConnection>();
     var client = new SearchClient(connection);
     var request = new SearchUsersRequest("github");
     client.SearchUsers(request);
     connection.Received().Get<SearchUsersResult>(
         Arg.Is<Uri>(u => u.ToString() == "search/users"),
         Arg.Is<Dictionary<string, string>>(d => d["q"] == "github"));
 }
开发者ID:nsavga,项目名称:octokit.net,代码行数:10,代码来源:SearchClientTests.cs


示例5: TestingTheAccountTypeQualifier_Org

 public void TestingTheAccountTypeQualifier_Org()
 {
     var connection = Substitute.For<IApiConnection>();
     var client = new SearchClient(connection);
     var request = new SearchUsersRequest("github");
     request.AccountType = AccountType.Org;
     client.SearchUsers(request);
     connection.Received().Get<SearchUsersResult>(
         Arg.Is<Uri>(u => u.ToString() == "search/users"),
         Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+type:Org"));
 }
开发者ID:nsavga,项目名称:octokit.net,代码行数:11,代码来源:SearchClientTests.cs


示例6: RefreshFromConnection

            public override ElasticResponse RefreshFromConnection(SearchClient cli)
            {
                var rawAliases = cli.GetAliases();
                if (rawAliases.HasData)
                {
                    var result = rawAliases.Data.Where(a => a.Value?.Aliases != null && a.Value.Aliases.Count > 0).ToDictionary(a => a.Key, a => a.Value.Aliases.Keys.ToList());
                    Aliases = result;
                }

                return rawAliases;
            }
开发者ID:shenqiboy,项目名称:Opserver,代码行数:11,代码来源:ElasticCluster.Aliases.cs


示例7: TestingTheStarsQualifier

            public void TestingTheStarsQualifier()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                //get repos whos stargazers are greater than 500
                var request = new SearchRepositoriesRequest("github");
                request.Stars = Range.GreaterThan(500);

                client.SearchRepo(request);

                connection.Received().GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"), Arg.Any<Dictionary<string, string>>());
            }
开发者ID:rgmills,项目名称:octokit.net,代码行数:12,代码来源:SearchClientTests.cs


示例8: TestingTheInQualifier

 public void TestingTheInQualifier()
 {
     var connection = Substitute.For<IApiConnection>();
     var client = new SearchClient(connection);
     //get users where the fullname contains 'github'
     var request = new SearchUsersRequest("github");
     request.In = new[] { UserInQualifier.Fullname };
     client.SearchUsers(request);
     connection.Received().Get<SearchUsersResult>(
         Arg.Is<Uri>(u => u.ToString() == "search/users"),
         Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Fullname"));
 }
开发者ID:nsavga,项目名称:octokit.net,代码行数:12,代码来源:SearchClientTests.cs


示例9: RefreshFromConnection

            public override ElasticResponse RefreshFromConnection(SearchClient cli)
            {
                var rawHealth = cli.GetClusterHealth();
                if (rawHealth.HasData)
                {
                    var health = rawHealth.Data;
                    Name = health.ClusterName;
                    TotalNodeCount = health.NumberOfNodes;
                    DataNodeCount = health.NumberOfDataNodes;
                    ActiveShards = health.ActiveShards;
                    ActivePrimaryShards = health.ActivePrimaryShards;
                    InitializingShards = health.InitializingShards;
                    RelocatingShards = health.RelocatingShards;
                    UnassignedShards = health.UnassignedShards;
                    StringStatus = health.Status;

                    Indices = health.Indices.Select(i => new NodeIndexInfo
                    {
                        Name = i.Key,
                        StringStatus = i.Value.Status,
                        NumberOfShards = i.Value.NumberOfShards,
                        NumberOfReplicas = i.Value.NumberOfReplicas,
                        ActiveShards = i.Value.ActiveShards,
                        ActivePrimaryShards = i.Value.ActivePrimaryShards,
                        InitializingShards = i.Value.InitializingShards,
                        RelocatingShards = i.Value.RelocatingShards,
                        UnassignedShards = i.Value.UnassignedShards,
                        Shards = i.Value.Shards.Select(s => new NodeIndexShardInfo
                        {
                            Name = s.Key,
                            StringStatus = s.Value.Status,
                            PrimaryActive = s.Value.PrimaryActive,
                            ActiveShards = s.Value.ActiveShards,
                            InitializingShards = s.Value.InitializingShards,
                            RelocatingShards = s.Value.RelocatingShards,
                            UnassignedShards = s.Value.UnassignedShards
                        }).ToList()
                    }).OrderBy(i =>
                    {
                        int j;
                        return int.TryParse(i.Name, out j) ? j : 0;
                    }).ToList();
                }
                else
                {
                    Indices = new List<NodeIndexInfo>();
                }
                return rawHealth;
            }
开发者ID:shenqiboy,项目名称:Opserver,代码行数:49,代码来源:ElasticCluster.HealthStatus.cs


示例10: RefreshFromConnection

            public override ElasticResponse RefreshFromConnection(SearchClient cli)
            {
                var infos = cli.GetClusterNodeInfo().Data;
                Name = infos.ClusterName;
                if (infos.Nodes != null)
                {
                    Nodes = infos.Nodes.Select(node => new NodeInfoWrap
                        {
                            GUID = node.Key,
                            Name = node.Value.Name,
                            Hostname = node.Value.Hostname,
                            VersionString = node.Value.Version,
                            BuildString = node.Value.Build,
                            Attributes = node.Value.Attributes,
                            Info = node.Value,
                        }).OrderBy(node => node.Name).ToList();
                }

                var rawStats = cli.GetClusterNodeStats();
                var stats = rawStats.Data;
                if (stats != null)
                {
                    Name = stats.ClusterName;
                    if (stats.Nodes != null)
                    {
                        foreach (var ns in stats.Nodes)
                        {
                            var ni = Nodes.FirstOrDefault(n => n.GUID == ns.Key);
                            if (ni != null)
                            {
                                ni.Stats = ns.Value;
                            }
                            else
                            {
                                Nodes.Add(new NodeInfoWrap
                                {
                                    GUID = ns.Key,
                                    Name = ns.Value.Name,
                                    Hostname = ns.Value.Hostname,
                                    Stats = ns.Value
                                });
                            }
                        }
                        Nodes = Nodes.OrderBy(n => n.Name).ToList();
                    }
                }
                return rawStats;
            }
开发者ID:shenqiboy,项目名称:Opserver,代码行数:48,代码来源:ElasticCluster.Nodes.cs


示例11: RefreshFromConnection

            public override ElasticResponse RefreshFromConnection(SearchClient cli)
            {
                var rawAliases = cli.GetAliases();
                if (rawAliases.HasData)
                {
                    var result = new Dictionary<string, List<string>>();
                    foreach (var a in rawAliases.Data)
                    {
                        if (a.Value != null && a.Value.Aliases != null && a.Value.Aliases.Count > 0)
                            result.Add(a.Key, a.Value.Aliases.Keys.ToList());
                    }
                    Aliases = result;
                }

                return rawAliases;
            }
开发者ID:JonBons,项目名称:Opserver,代码行数:16,代码来源:ElasticCluster.Aliases.cs


示例12: RefreshFromConnection

            public override ElasticResponse RefreshFromConnection(SearchClient cli)
            {
                var rawState = cli.GetClusterState();
                if (rawState.HasData)
                {
                    var state = rawState.Data;
                    ClusterName = state.ClusterName;
                    MasterNode = state.MasterNode;
                    Nodes = state.Nodes;
                    RoutingNodes = state.RoutingNodes;
                    if (state.RoutingTable != null)
                        RoutingIndices = state.RoutingTable.Indices;
                }

                return rawState;
            }
开发者ID:JonBons,项目名称:Opserver,代码行数:16,代码来源:ElasticCluster.Status.cs


示例13: PopulateFromConnections

        public void PopulateFromConnections(SearchClient client)
        {
            var response = RefreshFromConnection(client);

            // Some implementations are raw
            if (response?.Exception == null) return;
            string lastErrorMessage = response.Exception.Message;
            Exception lastException = response.Exception;

            // Failed to poll all nodes
            if (lastErrorMessage.HasValue())
            {
                throw new Exception($"Failed to poll all elastic nodes for {GetType().Name}: {lastErrorMessage}", lastException);
            }
            throw new Exception($"Failed to poll all elastic nodes for {GetType().Name}");
        }
开发者ID:shenqiboy,项目名称:Opserver,代码行数:16,代码来源:ElasticDataObject.cs


示例14: RefreshFromConnection

 public override ElasticResponse RefreshFromConnection(SearchClient cli)
 {
     var health = cli.GetIndexStats();
     if (health.HasData)
     {
         GlobalStats = health.Data.All;
         Shards = health.Data.Shards;
         Indices = health.Data.Indices;
     }
     else
     {
         GlobalStats = new IndexStats();
         Shards = new ShardCountStats();
         Indices = new Dictionary<string, IndexStats>();
     }
     return health;
 }
开发者ID:JonBons,项目名称:Opserver,代码行数:17,代码来源:ElasticCluster.Stats.cs


示例15: TestingTheCommentsQualifier_Range

            public void TestingTheCommentsQualifier_Range()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchIssuesRequest("something");
                request.Comments = new Range(10, 20);

                client.SearchIssues(request);

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


示例16: TestingTheInQualifier_Email

 public void TestingTheInQualifier_Email()
 {
     var connection = Substitute.For<IApiConnection>();
     var client = new SearchClient(connection);
     var request = new SearchUsersRequest("github");
     request.In = new[] { UserInQualifier.Email };
     client.SearchUsers(request);
     connection.Received().Get<SearchUsersResult>(
         Arg.Is<Uri>(u => u.ToString() == "search/users"),
         Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Email"));
 }
开发者ID:nsavga,项目名称:octokit.net,代码行数:11,代码来源:SearchClientTests.cs


示例17: TestingTheUpdatedQualifier_LessThanOrEquals

            public void TestingTheUpdatedQualifier_LessThanOrEquals()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchIssuesRequest("something");
                request.Updated = DateRange.LessThanOrEquals(new DateTime(2014, 1, 1));

                client.SearchIssues(request);

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


示例18: TestingTheLabelsQualifier_Multiple

            public void TestingTheLabelsQualifier_Multiple()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchIssuesRequest("something");
                request.Labels = new[] { "bug", "feature" };

                client.SearchIssues(request);

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


示例19: TestingTheLanguageQualifier

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

                client.SearchIssues(request);

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


示例20: TestingTheInvolvesQualifier

            public void TestingTheInvolvesQualifier()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new SearchClient(connection);
                var request = new SearchIssuesRequest("something");
                request.Involves = "alfhenrik";

                client.SearchIssues(request);

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SearchCodeRequest类代码示例发布时间:2022-05-24
下一篇:
C# Search类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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