This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
forked from chriseldredge/Lucene.Net.Linq
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LuceneSession/ISession implement unit-of-work pattern where pending c…
…hanges are committed when session is disposed. LuceneSession.Query() tracks modified items and flushes them during commit.
- Loading branch information
1 parent
9c739c6
commit f946b06
Showing
25 changed files
with
514 additions
and
111 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
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,38 @@ | ||
using System; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
|
||
namespace Lucene.Net.Linq.Tests.Integration | ||
{ | ||
[TestFixture] | ||
public class SessionTests : IntegrationTestBase | ||
{ | ||
protected override Analysis.Analyzer GetAnalyzer(Net.Util.Version version) | ||
{ | ||
return new LowercaseKeywordAnalyzer(); | ||
} | ||
|
||
[SetUp] | ||
public void AddDocuments() | ||
{ | ||
AddDocument(new SampleDocument { Name = "c", Scalar = 3, Flag = true, Version = new Version(100, 0, 0) }); | ||
AddDocument(new SampleDocument { Name = "a", Scalar = 1, Version = new Version(20, 0, 0) }); | ||
AddDocument(new SampleDocument { Name = "b", Scalar = 2, Flag = true, Version = new Version(3, 0, 0) }); | ||
} | ||
|
||
[Test] | ||
public void Query() | ||
{ | ||
var session = provider.OpenSession<SampleDocument>(); | ||
|
||
using (session) | ||
{ | ||
var item = (from d in session.Query() where d.Name == "a" select d).Single(); | ||
item.Scalar = 4; | ||
} | ||
|
||
var result = (from d in session.Query() where d.Name == "a" select d).Single(); | ||
Assert.That(result.Scalar, Is.EqualTo(4)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.