/// <summary>
        /// This method causes the communication listener to close. Close is a terminal state and this method allows the communication listener to transition to this state in a graceful manner.
        /// </summary>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <returns>A <see cref="Task">Task</see> that represents outstanding operation.</returns>
        public Task CloseAsync(CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                ServiceEventSource.Current.ServiceMessage(_context, "WireMock.Net Stopping");

                _server.Stop();
                _server.Dispose();

                ServiceEventSource.Current.ServiceMessage(_context, "WireMock.Net Stopped");

                return(Task.FromResult(true));
            }

            return(Task.FromResult(false));
        }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         stub.Stop();
         stub.Dispose();
     }
 }
Esempio n. 3
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         _mockServerSearchEngine.Stop();
         _mockServerSearchEngine.Dispose();
     }
 }
Esempio n. 4
0
 public void Dispose()
 {
     _mockServer.Stop();
     _mockServer.Dispose();
 }
Esempio n. 5
0
 public void Dispose()
 {
     _server?.Dispose();
 }
Esempio n. 6
0
 public static void AfterAll()
 {
     mockServer.Stop();
     mockServer.Dispose();
 }