1
- using StackExchange . Redis . Configuration ;
1
+ using Microsoft . Extensions . Logging . Abstractions ;
2
+ using StackExchange . Redis . Configuration ;
2
3
using System ;
3
4
using System . Globalization ;
4
5
using System . IO ;
5
6
using System . IO . Pipelines ;
6
7
using System . Linq ;
7
8
using System . Net ;
8
9
using System . Net . Sockets ;
10
+ using System . Reflection ;
9
11
using System . Security . Authentication ;
10
12
using System . Text ;
13
+ using System . Text . RegularExpressions ;
11
14
using System . Threading ;
12
15
using System . Threading . Tasks ;
13
- using Microsoft . Extensions . Logging . Abstractions ;
14
16
using Xunit ;
15
17
using Xunit . Abstractions ;
16
18
@@ -25,6 +27,37 @@ public ConfigTests(ITestOutputHelper output, SharedConnectionFixture fixture) :
25
27
public Version DefaultVersion = new ( 3 , 0 , 0 ) ;
26
28
public Version DefaultAzureVersion = new ( 4 , 0 , 0 ) ;
27
29
30
+ [ Fact ]
31
+ public void ExpectedFields ( )
32
+ {
33
+ // if this test fails, check that you've updated ConfigurationOptions.Clone(), then: fix the test!
34
+ // this is a simple but pragmatic "have you considered?" check
35
+
36
+ var fields = Array . ConvertAll ( typeof ( ConfigurationOptions ) . GetFields ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ,
37
+ x => Regex . Replace ( x . Name , """^<(\w+)>k__BackingField$""" , "$1" ) ) ;
38
+ Array . Sort ( fields ) ;
39
+ Assert . Equal ( new [ ] {
40
+ "abortOnConnectFail" , "allowAdmin" , "asyncTimeout" , "backlogPolicy" , "BeforeSocketConnect" ,
41
+ "CertificateSelection" , "CertificateValidation" , "ChannelPrefix" ,
42
+ "checkCertificateRevocation" , "ClientName" , "commandMap" ,
43
+ "configChannel" , "configCheckSeconds" , "connectRetry" ,
44
+ "connectTimeout" , "DefaultDatabase" , "defaultOptions" ,
45
+ "defaultVersion" , "EndPoints" , "heartbeatConsistencyChecks" ,
46
+ "heartbeatInterval" , "includeDetailInExceptions" , "includePerformanceCountersInExceptions" ,
47
+ "keepAlive" , "LibraryName" , "loggerFactory" ,
48
+ "password" , "Protocol" , "proxy" ,
49
+ "reconnectRetryPolicy" , "resolveDns" , "responseTimeout" ,
50
+ "ServiceName" , "setClientLibrary" , "SocketManager" ,
51
+ "ssl" ,
52
+ #if ! NETFRAMEWORK
53
+ "SslClientAuthenticationOptions" ,
54
+ #endif
55
+ "sslHost", "SslProtocols" ,
56
+ "syncTimeout" , "tieBreaker" , "Tunnel" ,
57
+ "user"
58
+ } , fields ) ;
59
+ }
60
+
28
61
[ Fact ]
29
62
public void SslProtocols_SingleValue ( )
30
63
{
0 commit comments