Skip to content

Commit

Permalink
Refactor connection string to app.config.
Browse files Browse the repository at this point in the history
  • Loading branch information
hhalim committed May 6, 2017
1 parent d2c7c12 commit 4f3822a
Show file tree
Hide file tree
Showing 21 changed files with 1,257 additions and 294 deletions.
13 changes: 6 additions & 7 deletions Shift.DataLayer/JobDALDocumentDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,10 @@ private async Task<int> UpdateAsync(string jobID, string appID, string userID, s

#region UnitTest Helper
//Used by UnitTest for adding/setting jobs
protected async Task<JobView> SetJobViewAsync(JobView jobView)
protected Job SetJob(Job job)
{
var response = await Client.UpsertDocumentAsync(CollectionLink, jobView);
jobView = (dynamic)response.Resource;
return jobView;
job = SetJobAsync(job).GetAwaiter().GetResult();
return job;
}

protected async Task<Job> SetJobAsync(Job job)
Expand Down Expand Up @@ -1171,7 +1170,7 @@ private async Task<int> CountRunningJobsAsync(string processID, bool isSync)

var sql = @"SELECT VALUE COUNT(1)
FROM Jobs j
WHERE j.ProcessID = '" + processID + "' AND j.Status = " + JobStatus.Running;
WHERE j.ProcessID = '" + processID + "' AND j.Status = " + (int)JobStatus.Running;

var query = Client.CreateDocumentQuery<int>(CollectionLink, sql, new FeedOptions { MaxItemCount = -1 }).AsDocumentQuery();
while (query.HasMoreResults)
Expand Down Expand Up @@ -1293,12 +1292,12 @@ private async Task<IReadOnlyCollection<Job>> ClaimJobsToRunAsync(string processI
/// </summary>
/// <param name="maxNum">Maximum number to return</param>
/// <returns>List of jobs</returns>
private IReadOnlyCollection<Job> GetJobsToRun(int maxNum)
protected IReadOnlyCollection<Job> GetJobsToRun(int maxNum)
{
return GetJobsToRunAsync(maxNum, true).GetAwaiter().GetResult();
}

private Task<IReadOnlyCollection<Job>> GetJobsToRunAsync(int maxNum)
protected Task<IReadOnlyCollection<Job>> GetJobsToRunAsync(int maxNum)
{
return GetJobsToRunAsync(maxNum, false);
}
Expand Down
449 changes: 403 additions & 46 deletions Shift.UnitTest.DataLayer/JobDALDocumentDBAsyncTest.cs

Large diffs are not rendered by default.

Loading

0 comments on commit 4f3822a

Please sign in to comment.