-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Autofac lifetime scope in server and client initialization.
- Loading branch information
Showing
21 changed files
with
130 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" /> | ||
<package id="StackExchange.Redis" version="1.2.4" targetFramework="net461" /> | ||
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net461" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Text; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using Xunit; | ||
using Shift.Entities; | ||
using Moq; | ||
using System.Linq.Expressions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Shift.UnitTest | ||
{ | ||
public class JobClientRedisAsyncTest | ||
{ | ||
JobClient jobClient; | ||
private const string AppID = "TestAppID"; | ||
|
||
public JobClientRedisAsyncTest() | ||
{ | ||
var appSettingsReader = new AppSettingsReader(); | ||
|
||
//Configure storage connection | ||
var clientConfig = new ClientConfig(); | ||
clientConfig.DBConnectionString = appSettingsReader.GetValue("RedisConnectionString", typeof(string)) as string; | ||
clientConfig.StorageMode = "redis"; | ||
jobClient = new JobClient(clientConfig); | ||
} | ||
|
||
[Fact] | ||
public async Task GetJob_Valid() | ||
{ | ||
var jobID = await jobClient.AddAsync(AppID, () => Console.WriteLine("Hello Test")); | ||
var job = await jobClient.GetJobAsync(jobID); | ||
|
||
await jobClient.DeleteJobsAsync(new List<string>() { jobID }); | ||
|
||
Assert.NotNull(job); | ||
Assert.Equal(jobID, job.JobID); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Text; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using Xunit; | ||
using Shift.Entities; | ||
using Moq; | ||
using System.Linq.Expressions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Shift.UnitTest | ||
{ | ||
public class JobClientRedisTest | ||
{ | ||
JobClient jobClient; | ||
private const string AppID = "TestAppID"; | ||
|
||
public JobClientRedisTest() | ||
{ | ||
var appSettingsReader = new AppSettingsReader(); | ||
|
||
//Configure storage connection | ||
var clientConfig = new ClientConfig(); | ||
clientConfig.DBConnectionString = appSettingsReader.GetValue("RedisConnectionString", typeof(string)) as string; | ||
clientConfig.StorageMode = "redis"; | ||
jobClient = new JobClient(clientConfig); | ||
} | ||
|
||
[Fact] | ||
public void GetJob_Valid() | ||
{ | ||
var jobID = jobClient.Add(AppID, () => Console.WriteLine("Hello Test")); | ||
var job = jobClient.GetJob(jobID); | ||
|
||
jobClient.DeleteJobs(new List<string>() { jobID }); | ||
|
||
Assert.NotNull(job); | ||
Assert.Equal(jobID, job.JobID); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Autofac" version="4.6.0" targetFramework="net461" /> | ||
<package id="Autofac" version="4.6.1" targetFramework="net461" /> | ||
<package id="Dapper" version="1.50.2" targetFramework="net461" /> | ||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" /> | ||
</packages> |