mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-19 23:11:20 +02:00
update WireMockServer_Should_delay_responses_for_a_given_route
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@@ -6,6 +6,7 @@ using System.Net.Http;
|
|||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using FluentAssertions;
|
||||||
using NFluent;
|
using NFluent;
|
||||||
using WireMock.RequestBuilders;
|
using WireMock.RequestBuilders;
|
||||||
using WireMock.ResponseBuilders;
|
using WireMock.ResponseBuilders;
|
||||||
@@ -93,7 +94,7 @@ namespace WireMock.Net.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task WireMockServer_Should_delay_responses_for_a_given_route()
|
public async Task WireMockServer_Should_delay_responses_for_a_given_route()
|
||||||
{
|
{
|
||||||
// given
|
// Arrange
|
||||||
var server = WireMockServer.Start();
|
var server = WireMockServer.Start();
|
||||||
|
|
||||||
server
|
server
|
||||||
@@ -103,14 +104,14 @@ namespace WireMock.Net.Tests
|
|||||||
.WithBody(@"{ msg: ""Hello world!""}")
|
.WithBody(@"{ msg: ""Hello world!""}")
|
||||||
.WithDelay(TimeSpan.FromMilliseconds(200)));
|
.WithDelay(TimeSpan.FromMilliseconds(200)));
|
||||||
|
|
||||||
// when
|
// Act
|
||||||
var watch = new Stopwatch();
|
var watch = new Stopwatch();
|
||||||
watch.Start();
|
watch.Start();
|
||||||
await new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + "/foo");
|
await new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + "/foo");
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
// then
|
// Asser.
|
||||||
Check.That(watch.ElapsedMilliseconds).IsStrictlyGreaterThan(200);
|
watch.ElapsedMilliseconds.Should().BeGreaterOrEqualTo(200);
|
||||||
|
|
||||||
server.Stop();
|
server.Stop();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user