mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-20 16:23:42 +01:00
ct
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Http;
|
||||
@@ -8,15 +9,17 @@ namespace WireMock.Net.Tests.Http;
|
||||
|
||||
public class StringContentHelperTests
|
||||
{
|
||||
private readonly CancellationToken _ct = TestContext.Current.CancellationToken;
|
||||
|
||||
[Fact]
|
||||
public void StringContentHelper_Create_WithNullContentType()
|
||||
public async Task StringContentHelper_Create_WithNullContentType()
|
||||
{
|
||||
// Act
|
||||
var result = StringContentHelper.Create("test", null);
|
||||
|
||||
// Assert
|
||||
result.Headers.ContentType.Should().BeNull();
|
||||
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||
(await result.ReadAsStringAsync(_ct)).Should().Be("test");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -24,7 +27,7 @@ public class StringContentHelperTests
|
||||
[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)
|
||||
public async Task StringContentHelper_Create(string test, string expected)
|
||||
{
|
||||
// Arrange
|
||||
var contentType = MediaTypeHeaderValue.Parse(test);
|
||||
@@ -33,7 +36,7 @@ public class StringContentHelperTests
|
||||
var result = StringContentHelper.Create("test", contentType);
|
||||
|
||||
// Assert
|
||||
result.Headers.ContentType.ToString().Should().Be(expected);
|
||||
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||
result.Headers.ContentType?.ToString().Should().Be(expected);
|
||||
(await result.ReadAsStringAsync(_ct)).Should().Be("test");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user