-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestSetup.cs
40 lines (34 loc) · 1.11 KB
/
TestSetup.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
using DotNetSampleApp.Services;
using Fauna;
using NUnit.Framework;
namespace DotNetSampleApp.Tests;
[SetUpFixture]
public class TestSetup
{
public static string Secret = "";
public static Client Client = null!;
[OneTimeSetUp]
public void SetupOnce()
{
if (Environment.GetEnvironmentVariable("FAUNA_SECRET") == null)
{
var c = new Client(new Configuration("secret")
{
Endpoint = new Uri("http://localhost:8443"),
});
Secret = c.QueryAsync<string>(Query.FQL($$"""
let k = Key.create({role: 'admin', database: 'ECommerceDotnet'})
k.secret
""")).Result.Data;
}
else
{
Secret = Environment.GetEnvironmentVariable("FAUNA_SECRET")!;
}
Client = new Client(new Configuration(Secret)
{
Endpoint = new Uri("http://localhost:8443"),
});
SeedService.Init(Client);
}
}