@@ -8,17 +8,12 @@ namespace SuperSocket.MySQL.Test
88 public class MainTest
99 {
1010 // Test configuration - these should be set via environment variables or test configuration
11- private const string TestHost = "localhost" ;
12- private const int TestPort = 3306 ;
13- private const string TestUsername = "root" ;
14- private const string TestPassword = "root" ;
15- private const string TestDatabase = "test" ;
1611
1712 [ Fact ]
1813 public async Task ConnectAsync_WithValidCredentials_ShouldAuthenticateSuccessfully ( )
1914 {
2015 // Arrange
21- var connection = new MySQLConnection ( TestHost , TestPort , TestUsername , TestPassword ) ;
16+ var connection = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , TestConst . Password ) ;
2217
2318 try
2419 {
@@ -39,7 +34,7 @@ public async Task ConnectAsync_WithValidCredentials_ShouldAuthenticateSuccessful
3934 public async Task ConnectAsync_WithInvalidCredentials_ShouldThrowException ( )
4035 {
4136 // Arrange
42- var connection = new MySQLConnection ( TestHost , TestPort , "invalid_user" , "invalid_password" ) ;
37+ var connection = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , "invalid_user" , "invalid_password" ) ;
4338
4439 // Act & Assert
4540 var exception = await Assert . ThrowsAsync < InvalidOperationException > (
@@ -54,7 +49,7 @@ public async Task ConnectAsync_WithInvalidCredentials_ShouldThrowException()
5449 public async Task ConnectAsync_WithEmptyPassword_ShouldHandleCorrectly ( )
5550 {
5651 // Arrange
57- var connection = new MySQLConnection ( TestHost , TestPort , TestUsername , "" ) ;
52+ var connection = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , "" ) ;
5853
5954 try
6055 {
@@ -83,8 +78,8 @@ public async Task ConnectAsync_WithEmptyPassword_ShouldHandleCorrectly()
8378 public async Task ConnectAsync_MultipleConnections_ShouldWorkIndependently ( )
8479 {
8580 // Arrange
86- var connection1 = new MySQLConnection ( TestHost , TestPort , TestUsername , TestPassword ) ;
87- var connection2 = new MySQLConnection ( TestHost , TestPort , TestUsername , TestPassword ) ;
81+ var connection1 = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , TestConst . Password ) ;
82+ var connection2 = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , TestConst . Password ) ;
8883
8984 try
9085 {
@@ -108,7 +103,7 @@ public async Task ConnectAsync_MultipleConnections_ShouldWorkIndependently()
108103 public async Task DisconnectAsync_AfterSuccessfulConnection_ShouldResetAuthenticationState ( )
109104 {
110105 // Arrange
111- var connection = new MySQLConnection ( TestHost , TestPort , TestUsername , TestPassword ) ;
106+ var connection = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , TestConst . Password ) ;
112107 await connection . ConnectAsync ( ) ;
113108 Assert . True ( connection . IsAuthenticated , "Precondition: Connection should be authenticated" ) ;
114109
@@ -124,7 +119,7 @@ public void Constructor_WithNullHost_ShouldThrowArgumentNullException()
124119 {
125120 // Act & Assert
126121 Assert . Throws < ArgumentNullException > ( ( ) =>
127- new MySQLConnection ( null , TestPort , TestUsername , TestPassword )
122+ new MySQLConnection ( null , TestConst . DefaultPort , TestConst . Username , TestConst . Password )
128123 ) ;
129124 }
130125
@@ -133,7 +128,7 @@ public void Constructor_WithNullUsername_ShouldThrowArgumentNullException()
133128 {
134129 // Act & Assert
135130 Assert . Throws < ArgumentNullException > ( ( ) =>
136- new MySQLConnection ( TestHost , TestPort , null , TestPassword )
131+ new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , null , TestConst . Password )
137132 ) ;
138133 }
139134
@@ -142,15 +137,15 @@ public void Constructor_WithNullPassword_ShouldThrowArgumentNullException()
142137 {
143138 // Act & Assert
144139 Assert . Throws < ArgumentNullException > ( ( ) =>
145- new MySQLConnection ( TestHost , TestPort , TestUsername , null )
140+ new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , null )
146141 ) ;
147142 }
148143
149144 [ Fact ]
150145 public async Task ConnectAsync_WithInvalidHost_ShouldThrowException ( )
151146 {
152147 // Arrange
153- var connection = new MySQLConnection ( "invalid-host-that-does-not-exist" , TestPort , TestUsername , TestPassword ) ;
148+ var connection = new MySQLConnection ( "invalid-host-that-does-not-exist" , TestConst . DefaultPort , TestConst . Username , TestConst . Password ) ;
154149
155150 // Act & Assert
156151 await Assert . ThrowsAnyAsync < Exception > ( async ( ) => await connection . ConnectAsync ( ) ) ;
@@ -161,7 +156,7 @@ public async Task ConnectAsync_WithInvalidHost_ShouldThrowException()
161156 public async Task ConnectAsync_WithInvalidPort_ShouldThrowException ( )
162157 {
163158 // Arrange
164- var connection = new MySQLConnection ( TestHost , 12345 , TestUsername , TestPassword ) ;
159+ var connection = new MySQLConnection ( TestConst . Host , 12345 , TestConst . Username , TestConst . Password ) ;
165160
166161 // Act & Assert
167162 await Assert . ThrowsAnyAsync < Exception > ( async ( ) => await connection . ConnectAsync ( ) ) ;
@@ -172,7 +167,7 @@ public async Task ConnectAsync_WithInvalidPort_ShouldThrowException()
172167 public async Task ExecuteQueryAsync_WithoutAuthentication_ShouldThrowException ( )
173168 {
174169 // Arrange
175- var connection = new MySQLConnection ( TestHost , TestPort , TestUsername , TestPassword ) ;
170+ var connection = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , TestConst . Password ) ;
176171
177172 // Act & Assert
178173 var exception = await Assert . ThrowsAsync < InvalidOperationException > (
@@ -186,7 +181,7 @@ public async Task ExecuteQueryAsync_WithoutAuthentication_ShouldThrowException()
186181 public async Task ExecuteQueryAsync_WithAuthentication_ShouldNotThrow ( )
187182 {
188183 // Arrange
189- var connection = new MySQLConnection ( TestHost , TestPort , TestUsername , TestPassword ) ;
184+ var connection = new MySQLConnection ( TestConst . Host , TestConst . DefaultPort , TestConst . Username , TestConst . Password ) ;
190185 await connection . ConnectAsync ( ) ;
191186
192187 try
0 commit comments