File tree Expand file tree Collapse file tree 4 files changed +153
-160
lines changed Expand file tree Collapse file tree 4 files changed +153
-160
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using Xunit ;
3+
4+ namespace LiteDB . Tests . Engine ;
5+
6+ public class Recursion_Tests
7+ {
8+ [ Fact ]
9+ public void UpdateInFindAll ( )
10+ {
11+ Test ( collection =>
12+ {
13+ foreach ( BsonDocument document in collection . FindAll ( ) )
14+ {
15+ collection . Update ( document ) ;
16+ }
17+ } ) ;
18+ }
19+ [ Fact ]
20+ public void InsertDeleteInFindAll ( )
21+ {
22+ Test ( collection =>
23+ {
24+ foreach ( BsonDocument document in collection . FindAll ( ) )
25+ {
26+ BsonValue id = collection . Insert ( new BsonDocument ( ) ) ;
27+ collection . Delete ( id ) ;
28+ }
29+ } ) ;
30+ }
31+ [ Fact ]
32+ public void QueryInFindAll ( )
33+ {
34+ Test ( collection =>
35+ {
36+ foreach ( BsonDocument document in collection . FindAll ( ) )
37+ {
38+ collection . Query ( ) . Count ( ) ;
39+ }
40+ } ) ;
41+ }
42+
43+ private void Test ( Action < ILiteCollection < BsonDocument > > action )
44+ {
45+ using LiteDatabase database = new ( new ConnectionString ( )
46+ {
47+ Filename = "Demo.db" ,
48+ Connection = ConnectionType . Shared ,
49+ } ) ;
50+
51+ ILiteCollection < BsonDocument > accounts = database . GetCollection ( "Recursion" ) ;
52+
53+ if ( accounts . Count ( ) < 3 )
54+ {
55+ accounts . Insert ( new BsonDocument ( ) ) ;
56+ accounts . Insert ( new BsonDocument ( ) ) ;
57+ accounts . Insert ( new BsonDocument ( ) ) ;
58+ }
59+ action ( accounts ) ;
60+ }
61+ }
Original file line number Diff line number Diff line change 1+ using Xunit ;
2+
3+ namespace LiteDB . Tests . Issues ;
4+
5+ public class Issue2534_Tests
6+ {
7+ [ Fact ]
8+ public void Test ( )
9+ {
10+ using LiteDatabase database = new ( new ConnectionString ( )
11+ {
12+ Filename = "Demo.db" ,
13+ Connection = ConnectionType . Shared ,
14+ } ) ;
15+
16+ ILiteCollection < BsonDocument > accounts = database . GetCollection ( "Issue2534" ) ;
17+
18+ if ( accounts . Count ( ) < 3 )
19+ {
20+ accounts . Insert ( new BsonDocument ( ) ) ;
21+ accounts . Insert ( new BsonDocument ( ) ) ;
22+ accounts . Insert ( new BsonDocument ( ) ) ;
23+ }
24+
25+ foreach ( BsonDocument document in accounts . FindAll ( ) )
26+ {
27+ accounts . Update ( document ) ;
28+ }
29+ }
30+ }
Original file line number Diff line number Diff line change 2929 </ItemGroup >
3030
3131 <ItemGroup >
32- <PackageReference Include =" FluentAssertions" Version =" 5.10.2 " />
33- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.4 .1" />
34- <PackageReference Include =" xunit" Version =" 2.4 .2" />
35- <PackageReference Include =" xunit.runner.console" Version =" 2.4 .2" >
32+ <PackageReference Include =" FluentAssertions" Version =" 6.12.1 " />
33+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.11 .1" />
34+ <PackageReference Include =" xunit" Version =" 2.9 .2" />
35+ <PackageReference Include =" xunit.runner.console" Version =" 2.9 .2" >
3636 <PrivateAssets >all</PrivateAssets >
3737 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
3838 </PackageReference >
39- <PackageReference Include =" xunit.runner.reporters" Version =" 2.4 .2" />
40- <PackageReference Include =" xunit.runner.visualstudio" Version =" 2.4.5 " >
39+ <PackageReference Include =" xunit.runner.reporters" Version =" 2.9 .2" />
40+ <PackageReference Include =" xunit.runner.visualstudio" Version =" 2.8.2 " >
4141 <PrivateAssets >all</PrivateAssets >
4242 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
4343 </PackageReference >
You can’t perform that action at this time.
0 commit comments