Exemplo n.º 1
0
            public void ShouldUseGetServersProcedure(string version)
            {
                // Given
                var discovery      = new ClusterDiscovery(null, null);
                var mock           = new Mock <IConnection>();
                var serverInfoMock = new Mock <IServerInfo>();

                serverInfoMock.Setup(m => m.Version).Returns(version);
                mock.Setup(m => m.Server).Returns(serverInfoMock.Object);
                // When
                var statement = discovery.DiscoveryProcedure(mock.Object);

                // Then
                statement.Text.Should().Be("CALL dbms.cluster.routing.getServers");
                statement.Parameters.Should().BeEmpty();
            }
            public void ShouldUseGetRoutingTableProcedure(string version)
            {
                // Given
                var context = new Dictionary <string, string> {
                    { "context", string.Empty }
                };
                var discovery      = new ClusterDiscovery(context, null);
                var mock           = new Mock <IConnection>();
                var serverInfoMock = new Mock <IServerInfo>();

                serverInfoMock.Setup(m => m.Version).Returns(version);
                mock.Setup(m => m.Server).Returns(serverInfoMock.Object);
                // When
                var statement = discovery.DiscoveryProcedure(mock.Object, null);

                // Then
                statement.Text.Should()
                .Be("CALL dbms.cluster.routing.getRoutingTable($context)");
                statement.Parameters["context"].Should().Be(context);
            }
Exemplo n.º 3
0
            public void ShouldUseGetRoutingTableForDatabaseProcedure(string version)
            {
                // Given
                var context = new Dictionary <string, string> {
                    { "context", string.Empty }
                };
                var discovery      = new ClusterDiscovery(context, null);
                var mock           = new Mock <IConnection>();
                var serverInfoMock = new Mock <IServerInfo>();

                serverInfoMock.Setup(m => m.Version).Returns(version);
                mock.Setup(m => m.Server).Returns(serverInfoMock.Object);
                mock.Setup(m => m.BoltProtocol).Returns(BoltProtocolV4.BoltV4);
                // When
                var query = discovery.DiscoveryProcedure(mock.Object, "foo");

                // Then
                query.Text.Should()
                .Be("CALL dbms.routing.getRoutingTable($context, $database)");
                query.Parameters["context"].Should().Be(context);
                query.Parameters["database"].Should().Be("foo");
            }