-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTestFixture.cs
49 lines (42 loc) · 1.03 KB
/
TestFixture.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
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;
namespace BalikoBot.Tests
{
public class TestFixture : IDisposable
{
/// <summary>
/// nastaveni testu
/// </summary>
public TestOptions Options;
/// <summary>
/// DI
/// </summary>
public IServiceProvider Services { get; private set; }
/// <summary>
/// initialize
/// </summary>
public TestFixture()
{
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", true)
.AddJsonFile("appsettings.workspace.json", true)
.Build();
// inicializace testovaci konfigurace
Options = configuration.GetSection("BalikoBot").Get<TestOptions>();
// DI
var services = new ServiceCollection();
services.AddSingleton<IBalikoBotConfiguration>(Options);
services.AddScoped<BalikoBotClientFactory>();
services.AddHttpClient();
Services = services.BuildServiceProvider();
}
/// <summary>
/// clean up
/// </summary>
public void Dispose()
{
}
}
}