Skip to content

Commit

Permalink
Escl: Prevent port collisions in ClientServerTests
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Sep 9, 2023
1 parent 1f41baa commit d08b648
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion NAPS2.Escl.Tests/ClientServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ public class ClientServerTests
[Fact]
public async Task ClientServer()
{
// TODO: Any better way to prevent port collisions when running tests?
#if NET6_0_OR_GREATER
int port = 9802;
#else
int port = 9801;
#endif
using var server = new EsclServer(new EsclServerConfig
{
Capabilities = new EsclCapabilities
Expand All @@ -18,7 +24,7 @@ public async Task ClientServer()
MakeAndModel = "HP Blah",
SerialNumber = "123abc"
}
}) { Port = 9801 };
}) { Port = port };
server.Start();
var client = new EsclClient(new EsclService
{
Expand Down

0 comments on commit d08b648

Please sign in to comment.