1111
1212namespace MTConnect . Tests . Agents
1313{
14+ /// <summary>Represents the agent runner.</summary>
1415 public class AgentRunner : IDisposable
1516 {
1617 // Generous, CI-safe bounds. The embedded HTTP server's Start() is
@@ -27,20 +28,32 @@ public class AgentRunner : IDisposable
2728 private readonly string _hostname ;
2829 private readonly int _port ;
2930
31+ /// <summary>Gets or sets the agent.</summary>
3032 public MTConnectAgentBroker Agent => _agent ;
3133
34+ /// <summary>Gets or sets the http server.</summary>
3235 public MTConnectHttpServer HttpServer => _httpServer ;
3336
37+ /// <summary>Gets or sets the devices.</summary>
3438 public IEnumerable < IDevice > Devices => _devices ;
3539
40+ /// <summary>Gets or sets the hostname.</summary>
3641 public string Hostname => _hostname ;
3742
43+ /// <summary>Gets or sets the port.</summary>
3844 public int Port => _port ;
3945
4046
47+ /// <summary>Initialises a new instance of the agent runner type.</summary>
48+ /// <param name="port">The port.</param>
49+ /// <param name="mtconnectVersion">The mtconnect version.</param>
4150 public AgentRunner ( int port , Version ? mtconnectVersion = null )
4251 : this ( IPAddress . Loopback . ToString ( ) , port , mtconnectVersion ) { }
4352
53+ /// <summary>Initialises a new instance of the agent runner type.</summary>
54+ /// <param name="hostname">The hostname.</param>
55+ /// <param name="port">The port.</param>
56+ /// <param name="mtconnectVersion">The mtconnect version.</param>
4457 public AgentRunner ( string hostname , int port = 5000 , Version ? mtconnectVersion = null )
4558 {
4659 _hostname = hostname ;
@@ -82,6 +95,8 @@ public AgentRunner(string hostname, int port = 5000, Version? mtconnectVersion =
8295
8396 // Picks a TCP port the OS confirms is free, so concurrently
8497 // constructed fixtures never collide on a hard-coded port.
98+ /// <summary>Runs the get free port operation.</summary>
99+ /// <returns>The result of the operation.</returns>
85100 public static int GetFreePort ( )
86101 {
87102 var listener = new TcpListener ( IPAddress . Loopback , 0 ) ;
@@ -96,6 +111,7 @@ public static int GetFreePort()
96111 }
97112 }
98113
114+ /// <summary>Runs the start operation.</summary>
99115 public void Start ( )
100116 {
101117 _agent . Start ( ) ;
@@ -107,6 +123,7 @@ public void Start()
107123 // CI-safe bound elapses. Polling the actual endpoint proves end to end
108124 // that the listener is bound and the agent is serving, removing the
109125 // start-up race that otherwise lets a client's first request fail.
126+ /// <summary>Runs the wait for ready operation.</summary>
110127 public void WaitForReady ( )
111128 {
112129 var deadline = DateTime . UtcNow . AddMilliseconds ( ServerReadyTimeoutMs ) ;
@@ -138,6 +155,7 @@ public void WaitForReady()
138155 + ( lastError != null ? $ " (last error: { lastError . Message } )." : "." ) ) ;
139156 }
140157
158+ /// <summary>Runs the stop operation.</summary>
141159 public void Stop ( )
142160 {
143161 _agent . Stop ( ) ;
@@ -172,6 +190,7 @@ private static void WaitForPortReleased(int port)
172190 }
173191 }
174192
193+ /// <summary>Runs the dispose operation.</summary>
175194 public void Dispose ( )
176195 {
177196 _httpServer . Dispose ( ) ;
0 commit comments