-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing #1585 expression cache problem
- Loading branch information
Showing
4 changed files
with
145 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using FluentAssertions; | ||
using LiteDB.Engine; | ||
using Xunit; | ||
|
||
namespace LiteDB.Issue1585 | ||
{ | ||
public class Issue1585_Tests | ||
{ | ||
public class PlayerDto | ||
{ | ||
[BsonId] | ||
public Guid Id { get; } | ||
public string Name { get; } | ||
|
||
public PlayerDto(Guid id, string name) | ||
{ | ||
Id = id; | ||
Name = name; | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Dto_Read() | ||
{ | ||
using (var db = new LiteDatabase(new MemoryStream())) | ||
{ | ||
var id = Guid.NewGuid(); | ||
var col = db.GetCollection<PlayerDto>(); | ||
col.Insert(new PlayerDto(id, "Bob")); | ||
var player = col.FindOne(x => x.Id == id); | ||
Assert.NotNull(player); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Dto_Read1() | ||
{ | ||
using (var db = new LiteDatabase(new MemoryStream())) | ||
{ | ||
var id = Guid.NewGuid(); | ||
var col = db.GetCollection<PlayerDto>(); | ||
col.Insert(new PlayerDto(id, "Bob")); | ||
var player = col.FindOne(x => x.Id == id); | ||
Assert.NotNull(player); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Dto_Read2() | ||
{ | ||
using (var db = new LiteDatabase(new MemoryStream())) | ||
{ | ||
var id = Guid.NewGuid(); | ||
var col = db.GetCollection<PlayerDto>(); | ||
col.Insert(new PlayerDto(id, "Bob")); | ||
var player = col.FindOne(x => x.Id == id); | ||
Assert.NotNull(player); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Dto_Read3() | ||
{ | ||
using (var db = new LiteDatabase(new MemoryStream())) | ||
{ | ||
var id = Guid.NewGuid(); | ||
var col = db.GetCollection<PlayerDto>(); | ||
col.Insert(new PlayerDto(id, "Bob")); | ||
var player = col.FindOne(x => x.Id == id); | ||
Assert.NotNull(player); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Dto_Read4() | ||
{ | ||
using (var db = new LiteDatabase(new MemoryStream())) | ||
{ | ||
var id = Guid.NewGuid(); | ||
var col = db.GetCollection<PlayerDto>(); | ||
col.Insert(new PlayerDto(id, "Bob")); | ||
var player = col.FindOne(x => x.Id == id); | ||
Assert.NotNull(player); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Dto_Read5() | ||
{ | ||
using (var db = new LiteDatabase(new MemoryStream())) | ||
{ | ||
var id = Guid.NewGuid(); | ||
var col = db.GetCollection<PlayerDto>(); | ||
col.Insert(new PlayerDto(id, "Bob")); | ||
var player = col.FindOne(x => x.Id == id); | ||
Assert.NotNull(player); | ||
} | ||
} | ||
|
||
} | ||
} |
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