Generate C# code from Mapping (#842)

* 1

* .

* v

* .

* .

* -

* b

* res b

* Fix UT

* .

* Verify

* v

* ...

* .

* .

* dir

* m
This commit is contained in:
Stef Heyenrath
2023-01-24 16:45:47 +01:00
committed by GitHub
parent b4c8779d68
commit 770a670e53
83 changed files with 3792 additions and 2942 deletions

View File

@@ -5,40 +5,39 @@ using FluentAssertions;
using WireMock.Http;
using Xunit;
namespace WireMock.Net.Tests.Http
namespace WireMock.Net.Tests.Http;
public class ByteArrayContentHelperTests
{
public class ByteArrayContentHelperTests
[Fact]
public async Task ByteArrayContentHelperTests_Create_WithNullContentType()
{
[Fact]
public async Task ByteArrayContentHelperTests_Create_WithNullContentType()
{
// Arrange
var content = Encoding.UTF8.GetBytes("test");
// Arrange
var content = Encoding.UTF8.GetBytes("test");
// Act
var result = ByteArrayContentHelper.Create(content, null);
// Act
var result = ByteArrayContentHelper.Create(content, null);
// Assert
result.Headers.ContentType.Should().BeNull();
(await result.ReadAsByteArrayAsync().ConfigureAwait(false)).Should().BeEquivalentTo(content);
}
[Theory]
[InlineData("application/octet-stream", "application/octet-stream")]
[InlineData("application/soap+xml", "application/soap+xml")]
[InlineData("multipart/form-data; boundary=------------------------x", "multipart/form-data; boundary=------------------------x")]
public async Task ByteArrayContentHelperTests_Create(string test, string expected)
{
// Arrange
var content = Encoding.UTF8.GetBytes("test");
var contentType = MediaTypeHeaderValue.Parse(test);
// Act
var result = ByteArrayContentHelper.Create(content, contentType);
// Assert
result.Headers.ContentType.ToString().Should().Be(expected);
(await result.ReadAsByteArrayAsync().ConfigureAwait(false)).Should().BeEquivalentTo(content);
}
// Assert
result.Headers.ContentType.Should().BeNull();
(await result.ReadAsByteArrayAsync().ConfigureAwait(false)).Should().BeEquivalentTo(content);
}
}
[Theory]
[InlineData("application/octet-stream", "application/octet-stream")]
[InlineData("application/soap+xml", "application/soap+xml")]
[InlineData("multipart/form-data; boundary=------------------------x", "multipart/form-data; boundary=------------------------x")]
public async Task ByteArrayContentHelperTests_Create(string test, string expected)
{
// Arrange
var content = Encoding.UTF8.GetBytes("test");
var contentType = MediaTypeHeaderValue.Parse(test);
// Act
var result = ByteArrayContentHelper.Create(content, contentType);
// Assert
result.Headers.ContentType.ToString().Should().Be(expected);
(await result.ReadAsByteArrayAsync().ConfigureAwait(false)).Should().BeEquivalentTo(content);
}
}