示例#1
0
            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);
            }
示例#2
0
            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);
            }
示例#3
0
            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);
            }
示例#4
0
            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");
            }