File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/Tests/Elasticsearch.Net.Tests.Unit/Stubs Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,15 @@ public static IReturnValueArgumentValidationConfiguration<Task<ElasticsearchResp
3131 public static IReturnValueConfiguration < ElasticsearchResponse < Stream > > PingAtConnectionLevel ( AutoFake fake )
3232 {
3333 return A . CallTo ( ( ) => fake . Resolve < IConnection > ( ) . HeadSync (
34- A < Uri > . That . Matches ( u => u . AbsolutePath == "/" ) , A < RequestConnectionConfiguration > . _ ) ) ;
34+ A < Uri > . That . Matches ( IsRoot ( ) ) , A < RequestConnectionConfiguration > . _ ) ) ;
3535 }
36+
37+
38+
3639 public static IReturnValueConfiguration < Task < ElasticsearchResponse < Stream > > > PingAtConnectionLevelAsync ( AutoFake fake )
3740 {
3841 return A . CallTo ( ( ) => fake . Resolve < IConnection > ( ) . Head (
39- A < Uri > . That . Matches ( u => u . AbsolutePath == "/" ) , A < RequestConnectionConfiguration > . _ ) ) ;
42+ A < Uri > . That . Matches ( IsRoot ( ) ) , A < RequestConnectionConfiguration > . _ ) ) ;
4043 }
4144
4245 public static IReturnValueConfiguration < ElasticsearchResponse < Stream > > Sniff (
@@ -63,7 +66,15 @@ private static Expression<Func<Uri, bool>> IsSniffUrl()
6366 {
6467 return u=> u . AbsolutePath . StartsWith ( "/_nodes/_all" ) ;
6568 }
66-
69+
70+ /// <summary>
71+ /// AbsolutePath == "" on .NET 3.5 but "/" thereafter.
72+ /// </summary>
73+ /// <returns></returns>
74+ private static Expression < Func < Uri , bool > > IsRoot ( )
75+ {
76+ return u=> u . AbsolutePath == "/" || u . AbsolutePath == "" ;
77+ }
6778 public static IReturnValueConfiguration < Task < ElasticsearchResponse < Stream > > > SniffAsync (
6879 AutoFake fake ,
6980 IConnectionConfigurationValues configurationValues = null ,
You can’t perform that action at this time.
0 commit comments