mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 16:48:59 +01:00
Generate C# code from Mapping (#842)
* 1 * . * v * . * . * - * b * res b * Fix UT * . * Verify * v * ... * . * . * dir * m
This commit is contained in:
@@ -1,39 +1,38 @@
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Headers;
|
||||
using FluentAssertions;
|
||||
using WireMock.Http;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Http
|
||||
namespace WireMock.Net.Tests.Http;
|
||||
|
||||
public class StringContentHelperTests
|
||||
{
|
||||
public class StringContentHelperTests
|
||||
[Fact]
|
||||
public void StringContentHelper_Create_WithNullContentType()
|
||||
{
|
||||
[Fact]
|
||||
public void StringContentHelper_Create_WithNullContentType()
|
||||
{
|
||||
// Act
|
||||
var result = StringContentHelper.Create("test", null);
|
||||
// Act
|
||||
var result = StringContentHelper.Create("test", null);
|
||||
|
||||
// Assert
|
||||
result.Headers.ContentType.Should().BeNull();
|
||||
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("application/json", "application/json")]
|
||||
[InlineData("application/soap+xml", "application/soap+xml")]
|
||||
[InlineData("application/soap+xml;charset=UTF-8", "application/soap+xml; charset=UTF-8")]
|
||||
[InlineData("application/soap+xml;charset=UTF-8;action=\"http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration\"", "application/soap+xml; charset=UTF-8; action=\"http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration\"")]
|
||||
public void StringContentHelper_Create(string test, string expected)
|
||||
{
|
||||
// Arrange
|
||||
var contentType = MediaTypeHeaderValue.Parse(test);
|
||||
|
||||
// Act
|
||||
var result = StringContentHelper.Create("test", contentType);
|
||||
|
||||
// Assert
|
||||
result.Headers.ContentType.ToString().Should().Be(expected);
|
||||
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||
}
|
||||
// Assert
|
||||
result.Headers.ContentType.Should().BeNull();
|
||||
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("application/json", "application/json")]
|
||||
[InlineData("application/soap+xml", "application/soap+xml")]
|
||||
[InlineData("application/soap+xml;charset=UTF-8", "application/soap+xml; charset=UTF-8")]
|
||||
[InlineData("application/soap+xml;charset=UTF-8;action=\"http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration\"", "application/soap+xml; charset=UTF-8; action=\"http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration\"")]
|
||||
public void StringContentHelper_Create(string test, string expected)
|
||||
{
|
||||
// Arrange
|
||||
var contentType = MediaTypeHeaderValue.Parse(test);
|
||||
|
||||
// Act
|
||||
var result = StringContentHelper.Create("test", contentType);
|
||||
|
||||
// Assert
|
||||
result.Headers.ContentType.ToString().Should().Be(expected);
|
||||
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user