public async Task ShouldPassDatabaseBookmarkAndTxConfigToRunWithMetadataMessage() { var mockConn = NewConnectionWithMode(); var query = new Query("A cypher query"); var bookmarkTracker = new Mock <IBookmarkTracker>(); var resourceHandler = new Mock <IResultResourceHandler>(); 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); }); await BoltV4.RunInAutoCommitTransactionAsync(mockConn.Object, query, true, bookmarkTracker.Object, resourceHandler.Object, Database, Bookmark, TxConfig); mockConn.Verify( x => x.EnqueueAsync(It.IsAny <RunWithMetadataMessage>(), It.IsAny <V4.RunResponseHandler>(), null, null), Times.Once); }
public async Task ResultBuilderShouldObtainServerInfoFromConnection() { var mockConn = AsyncSessionTests.MockedConnectionWithSuccessResponse(); var query = new Query("lalala"); await BoltV4.RunInExplicitTransactionAsync(mockConn.Object, query, true); mockConn.Verify(x => x.Server, Times.Once); }
public async Task ShouldRunPullAllSync() { var mockConn = AsyncSessionTests.MockedConnectionWithSuccessResponse(); var query = new Query("lalala"); await BoltV4.RunInExplicitTransactionAsync(mockConn.Object, query, true); mockConn.Verify( x => x.EnqueueAsync(It.IsAny <RunWithMetadataMessage>(), It.IsAny <V4.RunResponseHandler>(), null, null), Times.Once); mockConn.Verify(x => x.SendAsync(), 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>(); 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 BoltV4.RunInAutoCommitTransactionAsync(mockConn.Object, query, true, bookmarkTracker.Object, resourceHandler.Object, null, null, null); mockConn.Verify(x => x.Server, Times.Once); }
public async Task ShouldEnqueueRunPullAndSendIfNotReactive() { var mockConn = NewConnectionWithMode(); var query = new Query("A cypher query"); var bookmarkTracker = new Mock <IBookmarkTracker>(); var resourceHandler = new Mock <IResultResourceHandler>(); 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 BoltV4.RunInAutoCommitTransactionAsync(mockConn.Object, query, false, bookmarkTracker.Object, resourceHandler.Object, null, null, null); mockConn.Verify( x => x.EnqueueAsync(It.IsAny <RunWithMetadataMessage>(), It.IsAny <V4.RunResponseHandler>(), It.IsAny <PullMessage>(), It.IsAny <V4.PullResponseHandler>()), Times.Once); mockConn.Verify(x => x.SendAsync()); }