Skip to content

Commit

Permalink
Add tests to validate that encrypted dbs migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
JKamsker committed Jun 7, 2024
1 parent e7e1b49 commit 48565c3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions LiteDB.Tests/Issues/Issue2494_Tests.cs
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.

0 comments on commit 48565c3

Please sign in to comment.