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


C# MongoServerAddress.SequenceEqual方法代码示例

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



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

示例1: TestServersWithTwoServers

        public void TestServersWithTwoServers()
        {
            var settings = new MongoClientSettings();
            Assert.AreEqual(_localHost, settings.Server);
            Assert.IsTrue(new[] { _localHost }.SequenceEqual(settings.Servers));

            var servers = new MongoServerAddress[]
            {
                new MongoServerAddress("server1"),
                new MongoServerAddress("server2")
            };
            settings.Servers = servers;
            Assert.Throws<InvalidOperationException>(() => { var s = settings.Server; });
            Assert.IsTrue(servers.SequenceEqual(settings.Servers));

            settings.Freeze();
            Assert.Throws<InvalidOperationException>(() => { var s = settings.Server; });
            Assert.IsTrue(servers.SequenceEqual(settings.Servers));
            Assert.Throws<InvalidOperationException>(() => { settings.Servers = servers; });
        }
开发者ID:subbuballa,项目名称:mongo-csharp-driver,代码行数:20,代码来源:MongoClientSettingsTests.cs


示例2: TestTwoServers

        public void TestTwoServers()
        {
            var servers = new MongoServerAddress[]
            {
                new MongoServerAddress("server1"),
                new MongoServerAddress("server2")
            };

            var settings = new MongoServerSettings();
            settings.Servers = servers;
            Assert.IsTrue(servers.SequenceEqual(settings.Servers));

            Assert.Throws<InvalidOperationException>(() => { var s = settings.Server; });
        }
开发者ID:nickgervasi,项目名称:mongo-csharp-driver,代码行数:14,代码来源:MongoServerSettingsTests.cs



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