forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPersistenceTests.cs
More file actions
55 lines (49 loc) · 1.12 KB
/
PersistenceTests.cs
File metadata and controls
55 lines (49 loc) · 1.12 KB
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
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Waher.Persistence.Files.Test.Classes;
namespace Waher.Persistence.Files.Test
{
[TestClass]
public class PersistenceTests
{
[ClassInitialize]
public static async Task ClassInitialize(TestContext Context)
{
try
{
IDatabaseProvider p = Database.Provider;
}
catch
{
#if LW
Database.Register(await FilesProvider.CreateAsync("Data", "Default", 8192, 8192, 8192, Encoding.UTF8, 10000));
#else
Database.Register(await FilesProvider.CreateAsync("Data", "Default", 8192, 8192, 8192, Encoding.UTF8, 10000, true));
#endif
}
}
[TestMethod]
public async Task PersistenceTests_01_SaveNew()
{
int i;
for (i = 1; i <= 5; i++)
{
await Database.Insert(new StringFields()
{
A = string.Empty,
B = i.ToString(),
C = null
});
}
}
[TestMethod]
public async Task PersistenceTests_02_FindAll()
{
foreach (StringFields Obj in await Database.Find<StringFields>())
Console.Out.WriteLine(Obj.ToString());
}
}
}