public void ShouldNotSyncIfBookmarkIsNull() { var mockConn = new Mock <IConnection>(); BoltV1.BeginTransaction(mockConn.Object, null); mockConn.Verify(x => x.Enqueue(It.IsAny <RunMessage>(), It.IsAny <IMessageResponseCollector>(), PullAll), Times.Once); mockConn.Verify(x => x.Sync(), Times.Never); }
public void ShouldSyncIfValidBookmarkGiven() { var mockConn = new Mock <IConnection>(); var bookmark = Bookmark.From(FakeABookmark(234)); BoltV1.BeginTransaction(mockConn.Object, bookmark); mockConn.Verify(x => x.Enqueue(It.IsAny <RunMessage>(), It.IsAny <IMessageResponseCollector>(), PullAll), Times.Once); mockConn.Verify(x => x.Sync(), Times.Once); }
public void ShouldNotSyncIfInvalidBookmarkGiven() { var mockConn = new Mock <IConnection>(); var bookmark = Bookmark.From((string)null); BoltV1.BeginTransaction(mockConn.Object, bookmark, null); mockConn.Verify(x => x.Enqueue(It.IsAny <RunMessage>(), It.IsAny <IMessageResponseCollector>(), PullAll), Times.Once); mockConn.Verify(x => x.Sync(), Times.Never); }
public void ShouldThrowExceptionWhenTxConfigIsUsed() { var mockConn = new Mock <IConnection>(); var txConfig = new TransactionConfig { Timeout = TimeSpan.FromMinutes(1), Metadata = new Dictionary <string, object> { { "key1", "value1" } } }; var error = Xunit.Record.Exception(() => BoltV1.BeginTransaction(mockConn.Object, null, txConfig)); error.Should().BeOfType <ArgumentException>(); error.Message.Should() .StartWith("Driver is connected to the database that does not support transaction configuration"); }