Commit 06cdae2b authored by Nick Craver's avatar Nick Craver

Remove most TEST conditionals

parent 7e0a48cd
...@@ -252,59 +252,29 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel) ...@@ -252,59 +252,29 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel)
internal string GetConnectionName(EndPoint endPoint, ConnectionType connectionType) internal string GetConnectionName(EndPoint endPoint, ConnectionType connectionType)
=> GetServerEndPoint(endPoint)?.GetBridge(connectionType, false)?.PhysicalName; => GetServerEndPoint(endPoint)?.GetBridge(connectionType, false)?.PhysicalName;
#if TEST
internal event Action<string, Exception, string> MessageFaulted; internal event Action<string, Exception, string> MessageFaulted;
internal event Action<bool> Closing; internal event Action<bool> Closing;
internal event Action<EndPoint, ConnectionType> Connecting; internal event Action<EndPoint, ConnectionType> Connecting;
internal event Action<EndPoint, ConnectionType> Resurrecting; internal event Action<EndPoint, ConnectionType> Resurrecting;
#else
internal event Action<string, Exception, string> MessageFaulted
{ // completely empty shell event, just to keep the test suite compiling
add { } remove { }
}
internal event Action<bool> Closing
{ // completely empty shell event, just to keep the test suite compiling
add { } remove { }
}
internal event Action<EndPoint, ConnectionType> Connecting
{ // completely empty shell event, just to keep the test suite compiling
add { } remove { }
}
internal event Action<EndPoint, ConnectionType> Resurrecting
{ // completely empty shell event, just to keep the test suite compiling
add { } remove { }
}
#endif
[Conditional("TEST")]
internal void OnMessageFaulted(Message msg, Exception fault, [CallerMemberName] string origin = default, [CallerFilePath] string path = default, [CallerLineNumber] int lineNumber = default) internal void OnMessageFaulted(Message msg, Exception fault, [CallerMemberName] string origin = default, [CallerFilePath] string path = default, [CallerLineNumber] int lineNumber = default)
{ {
#if TEST
MessageFaulted?.Invoke(msg?.CommandAndKey, fault, $"{origin} ({path}#{lineNumber})"); MessageFaulted?.Invoke(msg?.CommandAndKey, fault, $"{origin} ({path}#{lineNumber})");
#endif
} }
[Conditional("TEST")]
internal void OnClosing(bool complete) internal void OnClosing(bool complete)
{ {
#if TEST
Closing?.Invoke(complete); Closing?.Invoke(complete);
#endif
} }
[Conditional("TEST")]
internal void OnConnecting(EndPoint endpoint, ConnectionType connectionType) internal void OnConnecting(EndPoint endpoint, ConnectionType connectionType)
{ {
#if TEST
Connecting?.Invoke(endpoint, connectionType); Connecting?.Invoke(endpoint, connectionType);
#endif
} }
[Conditional("TEST")]
internal void OnResurrecting(EndPoint endpoint, ConnectionType connectionType) internal void OnResurrecting(EndPoint endpoint, ConnectionType connectionType)
{ {
#if TEST
Resurrecting.Invoke(endpoint, connectionType); Resurrecting.Invoke(endpoint, connectionType);
#endif
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment