本文整理汇总了C#中MongoDB.Driver.MongoServerSettings.ToClusterKey方法的典型用法代码示例。如果您正苦于以下问题:C# MongoServerSettings.ToClusterKey方法的具体用法?C# MongoServerSettings.ToClusterKey怎么用?C# MongoServerSettings.ToClusterKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDB.Driver.MongoServerSettings
的用法示例。
在下文中一共展示了MongoServerSettings.ToClusterKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToClusterKey_should_copy_relevant_values
public void ToClusterKey_should_copy_relevant_values()
{
var credentials = new[] { MongoCredential.CreateMongoCRCredential("source", "username", "password") };
var servers = new[] { new MongoServerAddress("localhost") };
var sslSettings = new SslSettings
{
CheckCertificateRevocation = true,
EnabledSslProtocols = SslProtocols.Ssl3
};
var subject = new MongoServerSettings
{
ConnectionMode = ConnectionMode.Direct,
ConnectTimeout = TimeSpan.FromSeconds(1),
Credentials = credentials,
GuidRepresentation = GuidRepresentation.Standard,
IPv6 = true,
MaxConnectionIdleTime = TimeSpan.FromSeconds(2),
MaxConnectionLifeTime = TimeSpan.FromSeconds(3),
MaxConnectionPoolSize = 10,
MinConnectionPoolSize = 5,
ReplicaSetName = "rs",
LocalThreshold = TimeSpan.FromMilliseconds(20),
Servers = servers,
ServerSelectionTimeout = TimeSpan.FromSeconds(6),
SocketTimeout = TimeSpan.FromSeconds(4),
SslSettings = sslSettings,
UseSsl = true,
VerifySslCertificate = true,
WaitQueueSize = 20,
WaitQueueTimeout = TimeSpan.FromSeconds(5)
};
var result = subject.ToClusterKey();
result.ConnectionMode.Should().Be(subject.ConnectionMode);
result.ConnectTimeout.Should().Be(subject.ConnectTimeout);
result.Credentials.Should().Equal(subject.Credentials);
result.IPv6.Should().Be(subject.IPv6);
result.MaxConnectionIdleTime.Should().Be(subject.MaxConnectionIdleTime);
result.MaxConnectionLifeTime.Should().Be(subject.MaxConnectionLifeTime);
result.MaxConnectionPoolSize.Should().Be(subject.MaxConnectionPoolSize);
result.MinConnectionPoolSize.Should().Be(subject.MinConnectionPoolSize);
result.ReplicaSetName.Should().Be(subject.ReplicaSetName);
result.LocalThreshold.Should().Be(subject.LocalThreshold);
result.Servers.Should().Equal(subject.Servers);
result.ServerSelectionTimeout.Should().Be(subject.ServerSelectionTimeout);
result.SocketTimeout.Should().Be(subject.SocketTimeout);
result.SslSettings.Should().Be(subject.SslSettings);
result.UseSsl.Should().Be(subject.UseSsl);
result.VerifySslCertificate.Should().Be(subject.VerifySslCertificate);
result.WaitQueueSize.Should().Be(subject.WaitQueueSize);
result.WaitQueueTimeout.Should().Be(subject.WaitQueueTimeout);
}