fix contentTypeHeader

This commit is contained in:
Stef Heyenrath
2018-03-15 22:14:34 +01:00
parent 15500a812c
commit 82fdce4605
6 changed files with 66 additions and 10 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Threading.Tasks;
using NFluent;
using WireMock.ResponseBuilders;
using Xunit;
namespace WireMock.Net.Tests.ResponseBuilderTests
{
public class ResponseCreateTests
{
private const string ClientIp = "::1";
[Fact]
public async Task Response_Create()
{
// Assign
var responseMessage = new ResponseMessage { StatusCode = 500 };
var request = new RequestMessage(new Uri("http://localhost"), "GET", ClientIp);
var response = Response.Create(() => responseMessage);
// Act
var providedResponse = await response.ProvideResponseAsync(request);
// Assert
Check.That(providedResponse).Equals(responseMessage);
}
}
}

View File

@@ -3,7 +3,6 @@ using System.Text;
using System.Threading.Tasks;
using NFluent;
using WireMock.ResponseBuilders;
using WireMock.Util;
using Xunit;
namespace WireMock.Net.Tests.ResponseBuilderTests

View File

@@ -0,0 +1,27 @@
using System.IO;
using System.Text;
using System.Threading.Tasks;
using NFluent;
using WireMock.Util;
using Xunit;
namespace WireMock.Net.Tests.Util
{
public class BodyParserTests
{
[Fact]
public async Task BodyParser_Parse_ApplicationXml()
{
// Assign
var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes("<xml>hello</xml>"));
// Act
var body = await BodyParser.Parse(memoryStream, "application/xml; charset=UTF-8");
// Assert
Check.That(body.BodyAsBytes).IsNull();
Check.That(body.BodyAsJson).IsNull();
Check.That(body.BodyAsString).Equals("<xml>hello</xml>");
}
}
}