Ejemplo n.º 1
0
        public void ShouldUpdateVersionAndConnectionId()
        {
            var tracker = new Mock <IConnection>();
            var handler = new HelloResponseHandler(tracker.Object, new Protocol.BoltProtocolVersion(MajorVersion, MinorVersion));

            handler.OnSuccess(new[]
                              { ServerVersionCollectorTests.TestMetadata, ConnectionIdCollectorTests.TestMetadata }.ToDictionary());

            tracker.Verify(x => x.UpdateVersion(new ServerVersion(MajorVersion, MinorVersion, 0, null)), Times.Once);
            tracker.Verify(x => x.UpdateId(ConnectionIdCollectorTests.TestMetadataCollected), Times.Once);
        }
Ejemplo n.º 2
0
        public void ShouldUseProtocolVersionWhenPassedMetadata()
        {
            var mockClient = new Mock <ISocketClient>();
            var conn       = new SocketConnection(mockClient.Object, AuthTokens.None, ConnectionSettings.DefaultUserAgent, new Mock <ILogger>().Object, new ServerInfo(new Uri("http://neo4j.com")));

            var responseHandler = new HelloResponseHandler(conn, new Protocol.BoltProtocolVersion(MajorVersion, MinorVersion));

            responseHandler.OnSuccess(new[] { ServerVersionCollectorTests.TestMetadata, ConnectionIdCollectorTests.TestMetadata }.ToDictionary());

            //Ensure it is using the protocol version and not the version sent in the metadata
            conn.Server.Version.Should().ContainAll("Neo4j/" + MajorVersion + "." + MinorVersion + ".0");
        }