/
Services.cs
57 lines (48 loc) · 1.55 KB
/
Services.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
using System;
using FluentAssertions.Execution;
namespace FluentAssertions.Common
{
/// <summary>
/// Maintains the framework-specific services.
/// </summary>
public static class Services
{
private static readonly object lockable = new object();
private static Configuration configuration;
static Services()
{
ResetToDefaults();
}
public static IConfigurationStore ConfigurationStore { get; set; }
public static Configuration Configuration
{
get
{
lock (lockable)
{
if (configuration is null)
{
configuration = new Configuration(ConfigurationStore);
}
return configuration;
}
}
}
public static Action<string> ThrowException { get; set; }
public static IReflector Reflector { get; set; }
public static void ResetToDefaults()
{
#if NETSTANDARD1_3
Reflector = new NullReflector();
ConfigurationStore = new NullConfigurationStore();
#elif NETSTANDARD1_6
Reflector = new NetStandardReflector();
ConfigurationStore = new NullConfigurationStore();
#else
Reflector = new FullFrameworkReflector();
ConfigurationStore = new ConfigurationStoreExceptionInterceptor(new AppSettingsConfigurationStore());
#endif
ThrowException = TestFrameworkProvider.Throw;
}
}
}