mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-20 16:23:42 +01:00
Updated Using WireMock in UnitTests (markdown)
@@ -4,7 +4,7 @@ Obviously you can use your favourite test framework and use WireMock within your
|
||||
- clean up the request log or shutdown the server at the end of each test
|
||||
|
||||
Below a simple example using Nunit and NFluent test assertion library:
|
||||
```csharp
|
||||
```cs
|
||||
[SetUp]
|
||||
public void StartMockServer()
|
||||
{
|
||||
@@ -18,7 +18,7 @@ public async void Should_respond_to_request()
|
||||
_sut = new SomeComponentDoingHttpCalls();
|
||||
|
||||
_server
|
||||
.Given(Request.Create().WithUrl("/foo").UsingGet())
|
||||
.Given(Request.Create().WithPath("/foo").UsingGet())
|
||||
.RespondWith(
|
||||
Response.Create()
|
||||
.WithStatusCode(200)
|
||||
@@ -30,9 +30,6 @@ public async void Should_respond_to_request()
|
||||
|
||||
// then
|
||||
Check.That(response).IsEqualTo(EXPECTED_RESULT);
|
||||
|
||||
// and optionally
|
||||
Check.That(_server.FindLogEntries(Request.WithUrl("/error*")).IsEmpty();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
|
||||
Reference in New Issue
Block a user