forked from SciSharp/BotSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestEssential.cs
More file actions
39 lines (32 loc) · 1.56 KB
/
TestEssential.cs
File metadata and controls
39 lines (32 loc) · 1.56 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
using BotSharp.Core.Engines;
using EntityFrameworkCore.BootKit;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Configuration;
using System;
using System.IO;
using System.Linq;
namespace BotSharp.Core.UnitTest
{
public abstract class TestEssential
{
public static String BOT_ID = "6a9fd374-c43d-447a-97f2-f37540d0c725";
protected Database dc { get; set; }
protected string contentRoot;
public TestEssential()
{
contentRoot = $"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}BotSharp.WebHost{Path.DirectorySeparatorChar}";
contentRoot = Path.GetFullPath(contentRoot);
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
var settings = Directory.GetFiles(Path.Combine(contentRoot, "Settings"), "*.json");
settings.ToList().ForEach(setting =>
{
configurationBuilder.AddJsonFile(setting, optional: false, reloadOnChange: true);
});
AppDomain.CurrentDomain.SetData("DataPath", Path.Combine(contentRoot, "App_Data"));
AppDomain.CurrentDomain.SetData("Configuration", configurationBuilder.Build());
AppDomain.CurrentDomain.SetData("ContentRootPath", contentRoot);
AppDomain.CurrentDomain.SetData("Assemblies", new String[] { "BotSharp.Core" });
dc = new DefaultDataContextLoader().GetDefaultDc();
}
}
}