mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 16:48:59 +01:00
Observable logs (refactor some code)
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NFluent;
|
||||
using RestEase;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
@@ -21,7 +15,7 @@ namespace WireMock.Net.Tests
|
||||
[Fact]
|
||||
public async void Test()
|
||||
{
|
||||
// given
|
||||
// Assign
|
||||
_server = FluentMockServer.Start();
|
||||
|
||||
_server
|
||||
@@ -29,16 +23,15 @@ namespace WireMock.Net.Tests
|
||||
.WithPath("/foo")
|
||||
.UsingGet())
|
||||
.RespondWith(Response.Create()
|
||||
.WithStatusCode(200)
|
||||
.WithBody(@"{ msg: ""Hello world!""}"));
|
||||
|
||||
var count = 0;
|
||||
int count = 0;
|
||||
_server.LogEntriesChanged += (sender, args) => count++;
|
||||
|
||||
// when
|
||||
var response = await new HttpClient().GetAsync("http://localhost:" + _server.Ports[0] + "/foo");
|
||||
// Act
|
||||
await new HttpClient().GetAsync("http://localhost:" + _server.Ports[0] + "/foo");
|
||||
|
||||
// then
|
||||
// Assert
|
||||
Check.That(count).Equals(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user