Observable logs (refactor some code)

This commit is contained in:
Stef Heyenrath
2017-10-07 15:28:36 +02:00
parent 2d39a18b70
commit 207688e42b
9 changed files with 221 additions and 155 deletions

View File

@@ -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);
}