forked from litedb-org/LiteDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndexTest.cs
69 lines (53 loc) · 1.39 KB
/
IndexTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LiteDB;
using System.IO;
using System.Collections.Generic;
using System.Diagnostics;
namespace UnitTest
{
[TestClass]
public class IndexTest
{
private const string dbpath = @"C:\Temp\index.db";
[TestInitialize]
public void Init()
{
File.Delete(dbpath);
}
[TestMethod]
public void Index_Insert()
{
using (var db = new LiteEngine(dbpath))
{
var c = db.GetCollection("col1");
var d = new BsonDocument();
var id1 = c.NextVal();
var id2 = c.NextVal();
var id3 = c.NextVal();
d["Name"] = "John 1";
c.Insert(id1, d);
d["Name"] = "John 2";
c.Insert(id2, d);
d["Name"] = "John 3";
c.Insert(id3, d);
d["Name"] = "John A";
c.Insert("A", d);
var r = c.Find(Query.GTE("_id", 1));
foreach (var nd in r)
{
Debug.Print(nd["Name"].AsString);
}
}
}
[TestMethod]
public void Index_Search()
{
}
[TestMethod]
public void Index_Delete()
{
}
}
}