Exemple #1
0
            public void ResultBuilderShouldObtainServerInfoFromConnection()
            {
                var mockConn    = new Mock <IConnection>();
                var statement   = new Statement("A cypher query");
                var mockHandler = new Mock <IResultResourceHandler>();

                BoltV3.RunInAutoCommitTransaction(mockConn.Object, statement, mockHandler.Object, null, null);

                mockConn.Verify(x => x.Server, Times.Once);
            }
Exemple #2
0
            public void ShouldEnqueueRunAndPullAllAndSend()
            {
                var mockConn    = new Mock <IConnection>();
                var statement   = new Statement("A cypher query");
                var mockHandler = new Mock <IResultResourceHandler>();

                BoltV3.RunInAutoCommitTransaction(mockConn.Object, statement, mockHandler.Object, null, null);

                mockConn.Verify(x => x.Enqueue(It.IsAny <RunWithMetadataMessage>(), It.IsAny <ResultBuilder>(), PullAll), Times.Once);
                mockConn.Verify(x => x.Send());
            }
Exemple #3
0
            public void ShouldPassBookmarkAndTxConfigToRunWithMetadataMessage()
            {
                var mockConn    = new Mock <IConnection>();
                var statement   = new Statement("A cypher query");
                var mockHandler = new Mock <IResultResourceHandler>();

                mockConn.Setup(x => x.Enqueue(It.IsAny <RunWithMetadataMessage>(), It.IsAny <ResultBuilder>(), PullAll))
                .Callback <IRequestMessage, IMessageResponseCollector, IRequestMessage>(
                    (m0, r, m1) =>
                {
                    var msg = m0.CastOrThrow <RunWithMetadataMessage>();
                    VerifyMetadata(msg.Metadata);
                });
                BoltV3.RunInAutoCommitTransaction(mockConn.Object, statement, mockHandler.Object,
                                                  Bookmark, TxConfig);

                mockConn.Verify(x => x.Enqueue(It.IsAny <RunWithMetadataMessage>(), It.IsAny <ResultBuilder>(), PullAll), Times.Once);
            }