mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-16 15:16:53 +01:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
using System.Net.Http;
|
|
using NFluent;
|
|
using NUnit.Framework;
|
|
using WireMock.Http;
|
|
|
|
[module:
|
|
SuppressMessage("StyleCop.CSharp.DocumentationRules",
|
|
"SA1600:ElementsMustBeDocumented",
|
|
Justification = "Reviewed. Suppression is OK here, as it's a tests class.")]
|
|
[module:
|
|
SuppressMessage("StyleCop.CSharp.DocumentationRules",
|
|
"SA1633:FileMustHaveHeader",
|
|
Justification = "Reviewed. Suppression is OK here, as unknown copyright and company.")]
|
|
|
|
namespace WireMock.Net.Tests.Http
|
|
{
|
|
[TestFixture]
|
|
public class TinyHttpServerTests
|
|
{
|
|
[Test]
|
|
public void Should_call_handler_on_request()
|
|
{
|
|
// given
|
|
var port = Ports.FindFreeTcpPort();
|
|
bool called = false;
|
|
var urlPrefix = "http://localhost:" + port + "/";
|
|
var server = new TinyHttpServer(urlPrefix, ctx => called = true);
|
|
server.Start();
|
|
|
|
// when
|
|
var httpClient = new HttpClient();
|
|
httpClient.GetAsync(urlPrefix).Wait(3000);
|
|
|
|
// then
|
|
Check.That(called).IsTrue();
|
|
}
|
|
}
|
|
}
|