public void Commit_ThrowsInvalidOperationException_WhenNoTransactionIsOpened()
        {
            //Arrange
            var configuration = fixture.Create <PostgresConfiguration>();
            var unitOfWork    = new PostgresReadModelUnitOfWork(configuration, connectionFactory);

            //Act
            Action action = (() => unitOfWork.Commit());

            //Assert
            Assert.Throws <InvalidOperationException>(action);
        }
        public void Commit_CommitsAndDisposes_Transaction()
        {
            //Arrange
            var configuration = fixture.Create <PostgresConfiguration>();
            var unitOfWork    = new PostgresReadModelUnitOfWork(configuration, connectionFactory);

            //Act
            unitOfWork.BeginTransaction();
            unitOfWork.Commit();

            //Assert
            transaction.Received(1).Commit();
            transaction.Received(1).Dispose();
        }