-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tests.cs
62 lines (51 loc) · 1.25 KB
/
Tests.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
using Raven.Embedded;
[TestFixture]
public class Tests
{
static EmbeddedServer server;
static Tests()
{
server = EmbeddedServer.Instance;
var path = Path.Combine(Path.GetTempPath(), "RavenTestData");
if (Directory.Exists(path))
{
Directory.Delete(path, true);
}
Directory.CreateDirectory(path);
server.StartServer(
new()
{
DataDirectory = path
});
}
[Test]
public async Task Added()
{
using var store = await server.GetDocumentStoreAsync("Added");
using var session = store.OpenSession();
#region Added
var entity = new Person
{
Name = "John"
};
session.Store(entity);
await Verify(session);
#endregion
}
[Test]
public async Task Updated()
{
using var store = await server.GetDocumentStoreAsync("Updated");
using var session = store.OpenSession();
#region Updated
var entity = new Person
{
Name = "John"
};
session.Store(entity);
session.SaveChanges();
entity.Name = "Joe";
await Verify(session);
#endregion
}
}