forked from litedb-org/LiteDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests to validate that encrypted dbs migrate
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Xunit; | ||
|
||
namespace LiteDB.Tests.Issues; | ||
|
||
public class Issue2494_Tests | ||
{ | ||
[Fact] | ||
public static void Test() | ||
{ | ||
var original = "../../../Resources/Issue_2494_EncryptedV4.db"; | ||
using var filename = new TempFile(original); | ||
|
||
var connectionString = new ConnectionString(filename) | ||
{ | ||
Password = "pass123", | ||
Upgrade = true, | ||
}; | ||
|
||
using (var db = new LiteDatabase(connectionString)) // <= throws as of version 5.0.18 | ||
{ | ||
var col = db.GetCollection<PlayerDto>(); | ||
col.FindAll(); | ||
} | ||
} | ||
|
||
public class PlayerDto | ||
{ | ||
[BsonId] | ||
public Guid Id { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
public PlayerDto(Guid id, string name) | ||
{ | ||
Id = id; | ||
Name = name; | ||
} | ||
|
||
public PlayerDto() | ||
{ | ||
} | ||
} | ||
} |
Binary file not shown.