-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for Sqlite Encrypted Database
- Loading branch information
Showing
13 changed files
with
199 additions
and
89 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
130 changes: 65 additions & 65 deletions
130
Projects/Dotmim.Sync.Core/Interceptors/InterceptorExtensions.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using Dotmim.Sync.Tests.Core; | ||
using Dotmim.Sync.Tests.Misc; | ||
using Dotmim.Sync; | ||
using System; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Dotmim.Sync.Tests.SqlServer; | ||
using Dotmim.Sync.SqlServer; | ||
using Dotmim.Sync.Sqlite; | ||
using Dotmim.Sync.Tests.Models; | ||
|
||
namespace Dotmim.Sync.Tests.Sqlite | ||
{ | ||
/// <summary> | ||
/// this is the class which implements concret fixture with SqlSyncProviderFixture | ||
/// and will call all the base tests | ||
/// </summary> | ||
[TestCaseOrderer("Dotmim.Sync.Tests.Misc.PriorityOrderer", "Dotmim.Sync.Tests")] | ||
[Collection("Sqlite")] | ||
public class SqliteEncryptedTests | ||
{ | ||
private string[] sqlTables; | ||
private SqlSyncProvider serverProvider; | ||
private SqliteSyncProvider clientProvider; | ||
private string serverCString = HelperDB.GetConnectionString(ProviderType.Sql, "AdvWorksForEncrypted"); | ||
private string clientCString = HelperDB.GetConnectionString(ProviderType.Sqlite, "EncryptedAdventureWorks.db"); | ||
|
||
public SqliteEncryptedTests() | ||
{ | ||
this.sqlTables = new string[] | ||
{ | ||
"SalesLT.ProductCategory", "SalesLT.ProductModel", "SalesLT.Product", "Employee", "Customer", "Address", "CustomerAddress", "EmployeeAddress", | ||
"SalesLT.SalesOrderHeader", "SalesLT.SalesOrderDetail", "dbo.Sql", "Posts", "Tags", "PostTag", | ||
"PricesList", "PriceListCategory", "PriceListDetail" | ||
}; | ||
|
||
|
||
this.serverProvider = new SqlSyncProvider(serverCString); | ||
this.clientProvider = new SqliteSyncProvider(clientCString); | ||
} | ||
|
||
[Fact, TestPriority(1)] | ||
public async Task Initialize() | ||
{ | ||
try | ||
{ | ||
|
||
using (var ctx = new AdventureWorksContext()) | ||
{ | ||
ctx.ProviderType = ProviderType.Sql; | ||
ctx.ConnectionString = this.serverCString; | ||
ctx.useSeeding = true; | ||
ctx.useSchema = true; | ||
|
||
ctx.Database.EnsureDeleted(); | ||
ctx.Database.EnsureCreated(); | ||
} | ||
|
||
var agent = new SyncAgent(this.clientProvider, this.serverProvider, this.sqlTables); | ||
|
||
agent.LocalProvider.OnConnectionOpen(args => | ||
{ | ||
var keyCommand = args.Connection.CreateCommand(); | ||
keyCommand.CommandText = "PRAGMA key = 'password';"; | ||
keyCommand.ExecuteNonQuery(); | ||
|
||
}); | ||
|
||
var s = await agent.SynchronizeAsync(); | ||
|
||
Assert.Equal(109, s.TotalChangesDownloaded); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine(ex); | ||
throw; | ||
} | ||
} | ||
|
||
} | ||
} |
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