using System.Security.Authentication; namespace SQLInsight.Connectivity.Tests; public class LegacyFailureClassifierTests { [Fact] public void Tls_authentication_failure_is_legacy() { var ex = new InvalidOperationException("outer", new AuthenticationException("handshake failed")); Assert.True(LegacyFailureClassifier.IsLegacyIncompatibility(ex)); } [Fact] public void Pre_login_handshake_message_is_legacy() { var ex = new InvalidOperationException( "A connection was successfully established with the server, but then an error occurred during the pre-login handshake."); Assert.True(LegacyFailureClassifier.IsLegacyIncompatibility(ex)); } [Theory] [InlineData("Login failed for user 'x'.")] [InlineData("A network-related or instance-specific error occurred while establishing a connection to SQL Server.")] [InlineData("Cannot open database \"master\" requested by the login.")] public void Login_and_network_failures_are_not_legacy(string message) { Assert.False(LegacyFailureClassifier.IsLegacyIncompatibility(new InvalidOperationException(message))); } }