Beispiel #1
0
        public void AreSessionsSupported_should_return_expected_result(string clusterDescriptionJson, bool?expectedResult)
        {
            var subject            = new MongoClient("mongodb://localhost");
            var clusterDescription = ClusterDescriptionParser.Parse(clusterDescriptionJson);

            var result = subject.AreSessionsSupported(clusterDescription);

            result.Should().Be(expectedResult);
        }
Beispiel #2
0
        public void SelectServers_should_return_all_servers_when_connection_mode_is_direct(string clusterDescriptionJson)
        {
            var subject          = CreateSubject();
            var cluster          = ClusterDescriptionParser.Parse(clusterDescriptionJson);
            var connectedServers = cluster.Servers.Where(s => s.State == ServerState.Connected).ToList();

            var result = subject.SelectServers(cluster, connectedServers);

            result.Should().Equal(connectedServers);
        }
Beispiel #3
0
        public void SelectServers_should_set_ClusterDescription(string clusterDescriptionJson)
        {
            var subject          = CreateSubject();
            var cluster          = ClusterDescriptionParser.Parse(clusterDescriptionJson);
            var connectedServers = cluster.Servers.Where(s => s.State == ServerState.Connected);

            var result = subject.SelectServers(cluster, connectedServers);

            AreSessionsSupportedServerSelectorReflector.ClusterDescription(subject).Should().BeSameAs(cluster);
        }