public int Execute(ConnectionSetting connection, int jobId, IDbConnection dbConnection)
        {
            const string query = "UPDATE ReportJobQueue SET ProcessStartDate = @ProcessStartDate, Status = @Status WHERE Id = @Id";

            _concurrencyCoordinator.LockReportJob(connection.Name, jobId);
            return(dbConnection.Execute(query, new { Id = jobId, ProcessStartDate = DateTime.UtcNow, Status = JobStatus.Processing }));
        }
        public void LockReportJob_OnCall_CreatesTextFile()
        {
            // setup
            string connectionName   = Path.GetRandomFileName();
            int    jobId            = new Random().Next(1, 100);
            string processingFolder = Path.Combine(_testRootFolder, connectionName);

            _reportLocationProvider.GetProcessingFolder(connectionName).Returns(processingFolder);
            Directory.CreateDirectory(processingFolder);

            // execute
            _concurrencyCoordinator.LockReportJob(connectionName, jobId);

            string expectedPath = Path.Combine(processingFolder, jobId.ToString());

            Assert.IsTrue(File.Exists(expectedPath));

            // clean up
            Directory.Delete(processingFolder, true);
        }