public async Task ShouldPassBookmarkAndTxConfigToRunWithMetadataMessage(AccessMode mode) { var mockConn = NewConnectionWithMode(mode); var query = new Query("A cypher query"); var bookmarkTracker = new Mock <IBookmarkTracker>(); var resourceHandler = new Mock <IResultResourceHandler>(); var V3 = new BoltProtocolV3(); mockConn.Setup(x => x.EnqueueAsync(It.IsAny <IRequestMessage>(), It.IsAny <IResponseHandler>(), It.IsAny <IRequestMessage>(), It.IsAny <IResponseHandler>())) .Returns(Task.CompletedTask) .Callback <IRequestMessage, IResponseHandler, IRequestMessage, IResponseHandler>( (m1, h1, m2, h2) => { h1.OnSuccess(new Dictionary <string, object>()); VerifyMetadata(m1.CastOrThrow <RunWithMetadataMessage>().Metadata, mode); }); await V3.RunInAutoCommitTransactionAsync(mockConn.Object, query, true, bookmarkTracker.Object, resourceHandler.Object, null, Bookmark, TxConfig); mockConn.Verify( x => x.EnqueueAsync(It.IsAny <RunWithMetadataMessage>(), It.IsAny <V3.RunResponseHandler>(), PullAllMessage.PullAll, It.IsAny <V3.PullResponseHandler>()), Times.Once); }
public async Task ResultBuilderShouldObtainServerInfoFromConnection() { var mockConn = NewConnectionWithMode(); var query = new Query("A cypher query"); var bookmarkTracker = new Mock <IBookmarkTracker>(); var resourceHandler = new Mock <IResultResourceHandler>(); var V3 = new BoltProtocolV3(); mockConn.Setup(x => x.EnqueueAsync(It.IsAny <IRequestMessage>(), It.IsAny <IResponseHandler>(), It.IsAny <IRequestMessage>(), It.IsAny <IResponseHandler>())) .Returns(Task.CompletedTask) .Callback <IRequestMessage, IResponseHandler, IRequestMessage, IResponseHandler>( (msg1, h1, msg2, h2) => { h1.OnSuccess(new Dictionary <string, object>()); }); await V3.RunInAutoCommitTransactionAsync(mockConn.Object, query, true, bookmarkTracker.Object, resourceHandler.Object, null, null, null); mockConn.Verify(x => x.Server, Times.Once); }