public bool Stop(HostControl hostControl)
 {
     _logger.Debug("Stopping...");
     _server.Stop();
     _logger.Debug("Stopped");
     return(true);
 }
        public async Task InitializeAndSubmitBadResponse()
        {
            FluentMockServer server = null;

            try
            {
                server = FluentMockServer.Start(new FluentMockServerSettings {
                    Urls = new[] { "http://+:5010" }
                });

                server
                .Given(Request.Create().WithPath("/Query").UsingGet())
                .RespondWith(
                    Response.Create()
                    .WithStatusCode(200)
                    .WithBody(@"{ ""msg"": ""Hello world!"" }")
                    );

                var handler = new PostHandler("http://localhost:5010/");

                var file = Path.GetTempFileName();

                var result = await handler.SubmitQueryHashAsync(file);

                Assert.IsNull(result);
            }
            finally
            {
                server?.Stop();
            }
        }
        /// <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));
        }
 void IDisposable.Dispose()
 {
     _server.Stop();
     if (_ep != null)
     {
         _ep.Dispose();
     }
 }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         stub.Stop();
         stub.Dispose();
     }
 }
Esempio n. 6
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         _mockServerSearchEngine.Stop();
         _mockServerSearchEngine.Dispose();
     }
 }
Esempio n. 7
0
        public void Dispose()
        {
            _mockServer.Stop();

            var standardOutput = new StreamWriter(Console.OpenStandardOutput())
            {
                AutoFlush = true
            };

            Console.SetOut(standardOutput);
        }
        public async Task InitializeAndSubmitGoodResponse()
        {
            FluentMockServer server = null;

            try
            {
                server = FluentMockServer.Start(new FluentMockServerSettings {
                    Urls = new[] { "http://+:5010" }
                });

                server
                .Given(Request.Create().WithPath("/Query").UsingPost())
                .RespondWith(
                    Response.Create()
                    .WithStatusCode(200)
                    .WithBody(@"{
                              ""guid"": ""00000000-0000-0000-0000-000000000000"",
                              ""status"": ""SUBMITTED"",
                              ""mD5Hash"": ""12345"",
                              ""errorMessage"": null,
                              ""isMalicious"": false
                            }")
                    );

                var handler = new PostHandler("http://localhost:5010/");

                var file = Path.GetTempFileName();

                var result = await handler.SubmitQueryHashAsync(file);

                Assert.IsNotNull(result);
                Assert.AreEqual(ResponseStatus.SUBMITTED, result.Status);
                Assert.AreEqual("12345", result.MD5Hash);
                Assert.AreEqual(false, result.IsMalicious);
                Assert.AreEqual(Guid.Empty, result.Guid);
                Assert.IsNull(result.ErrorMessage);
            }
            finally
            {
                server?.Stop();
            }
        }
Esempio n. 9
0
 public void Dispose()
 {
     server.Stop();
 }
 public void Dispose()
 {
     _server?.Dispose();
     Client?.Dispose();
     bussinessMock.Stop();
 }
Esempio n. 11
0
 private static void Stop(string why)
 {
     Console.WriteLine($"{DateTime.UtcNow} WireMock.Net server stopping because '{why}'");
     _server.Stop();
     Console.WriteLine($"{DateTime.UtcNow} WireMock.Net server stopped");
 }
Esempio n. 12
0
 public static void ShutdownServer()
 {
     Server.Stop();
 }
 public void TearDown()
 {
     server.Stop();
 }
Esempio n. 14
0
        public async Task TearDown()
        {
            await Database.Users.DeleteOneAsync(x => x.Id == _user.Id);

            _fluentMockServer.Stop();
        }
 public void TearDown()
 {
     _fakeHackerNewsServer.Stop();
 }
Esempio n. 16
0
 public void Dispose()
 {
     _mockServer.Stop();
     _mockServer.Dispose();
 }
 public void Dispose()
 {
     _server?.Stop();
     _serverForProxyForwarding?.Stop();
 }
Esempio n. 18
0
 public static void Destroy()
 {
     server.Stop();
 }
Esempio n. 19
0
 public void TearDown()
 {
     _fakeBankServer.Stop();
 }
Esempio n. 20
0
 public static void AfterAll()
 {
     mockServer.Stop();
     mockServer.Dispose();
 }
Esempio n. 21
0
 public void ShutdownServer()
 {
     _mockServer.Stop();
 }
 public void Dispose()
 {
     _server.Stop();
     _server.ResetLogEntries();
     //MetricsManager.Shutdown();
 }
Esempio n. 23
0
 private static void Stop()
 {
     _server.Stop();
 }
Esempio n. 24
0
 public void CleanUp()
 {
     _server.Stop();
 }
Esempio n. 25
0
 public void Teardown()
 {
     _server.Stop();
 }
Esempio n. 26
0
 public void TearDown()
 {
     responseServer.Stop();
 }
Esempio n. 27
0
 public static void CleanClass()
 {
     stub.Stop();
 }
 //[TearDown]
 public void Dispose()
 {
     _server?.Stop();
 }
Esempio n. 29
0
 public void ShutdownServer()
 {
     MockServer?.Stop();
 }
Esempio n. 30
0
 public void ShutdownServer()
 {
     _server.Stop();
 }