diff --git a/tests/HttpTests.cs b/tests/HttpTests.cs index d89e93c..a43613f 100644 --- a/tests/HttpTests.cs +++ b/tests/HttpTests.cs @@ -152,7 +152,7 @@ protected override void OnError(SocketError error) public class HttpTests { [Fact(DisplayName = "HTTP server test")] - public async void HttpServerTest() + public void HttpServerTest() { string address = "127.0.0.1"; int port = 8080; @@ -167,21 +167,21 @@ public async void HttpServerTest() var client = new HttpClientEx(address, port); // Test CRUD operations - var response = await client.SendGetRequest("/test"); + var response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 404); - response = await client.SendPostRequest("/test", "old_value"); + response = client.SendPostRequest("/test", "old_value").Result; Assert.True(response.Status == 200); - response = await client.SendGetRequest("/test"); + response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 200); Assert.True(response.Body == "old_value"); - response = await client.SendPutRequest("/test", "new_value"); + response = client.SendPutRequest("/test", "new_value").Result; Assert.True(response.Status == 200); - response = await client.SendGetRequest("/test"); + response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 200); Assert.True(response.Body == "new_value"); - response = await client.SendDeleteRequest("/test"); + response = client.SendDeleteRequest("/test").Result; Assert.True(response.Status == 200); - response = await client.SendGetRequest("/test"); + response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 404); // Stop the HTTP server diff --git a/tests/HttpsTests.cs b/tests/HttpsTests.cs index 1ca8bb9..fb1f4b7 100644 --- a/tests/HttpsTests.cs +++ b/tests/HttpsTests.cs @@ -109,7 +109,7 @@ protected override void OnError(SocketError error) public class HttpsTests { [Fact(DisplayName = "HTTPS server test")] - public async void HttpsServerTest() + public void HttpsServerTest() { string address = "127.0.0.1"; int port = 8443; @@ -128,21 +128,21 @@ public async void HttpsServerTest() var client = new HttpsClientEx(client_context, address, port); // Test CRUD operations - var response = await client.SendGetRequest("/test"); + var response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 404); - response = await client.SendPostRequest("/test", "old_value"); + response = client.SendPostRequest("/test", "old_value").Result; Assert.True(response.Status == 200); - response = await client.SendGetRequest("/test"); + response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 200); Assert.True(response.Body == "old_value"); - response = await client.SendPutRequest("/test", "new_value"); + response = client.SendPutRequest("/test", "new_value").Result; Assert.True(response.Status == 200); - response = await client.SendGetRequest("/test"); + response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 200); Assert.True(response.Body == "new_value"); - response = await client.SendDeleteRequest("/test"); + response = client.SendDeleteRequest("/test").Result; Assert.True(response.Status == 200); - response = await client.SendGetRequest("/test"); + response = client.SendGetRequest("/test").Result; Assert.True(response.Status == 404); // Stop the HTTPS server diff --git a/tests/ProtoTests.cs b/tests/ProtoTests.cs index c457184..3aaa25c 100644 --- a/tests/ProtoTests.cs +++ b/tests/ProtoTests.cs @@ -262,7 +262,7 @@ public ProtoServer(IPAddress address, int port) : base(address, port) public class ProtoTests { [Fact(DisplayName = "Protocol server test")] - public async void ProtoServerTest() + public void ProtoServerTest() { string address = "127.0.0.1"; int port = 4444; @@ -282,7 +282,7 @@ public async void ProtoServerTest() // Send a request to the protocol server SimpleRequest request = SimpleRequest.Default; request.Message = "test"; - var response = await client.Request(request); + var response = client.Request(request).Result; Assert.Equal(request.id, response.id); Assert.Equal(0u, response.Hash); Assert.Equal(4u, response.Length); diff --git a/tests/tests.csproj b/tests/tests.csproj index e6cbdcc..fa6b597 100644 --- a/tests/tests.csproj +++ b/tests/tests.csproj @@ -3,6 +3,7 @@ net8.0 false + xUnit1031