Version 2.x (#1359)

* Version 2.x

* Setup .NET 9

* 12

* cleanup some #if for NETSTANDARD1_3

* cleanup + fix tests for net8

* openapi

* NO ConfigureAwait(false) + cleanup

* .

* #endif

* HashSet

* WireMock.Net.NUnit

* HttpContext

* Add WebSockets (#1423)

* Add WebSockets

* Add tests

* fix

* more tests

* Add tests

* ...

* remove IOwin

* -

* tests

* fluent

* ok

* match

* .

* byte[]

* x

* func

* func

* byte

* trans

* ...

* frameworks.........

* jmes

* xxx

* sc

* using var httpClient = new HttpClient();

* usings

* maxRetries

* up

* xunit v3

* ct

* ---

* ct

* ct2

* T Unit

* WireMock.Net.TUnitTests / 10

* t unit first

* --project

* no tunit

* t2

* --project

* --project

* ci -  --project

* publish ./test/wiremock-coverage.xml

* windows

* .

* log

* ...

* log

* goed

* BodyType

* .

* .

* --scenario

* ...

* pact

* ct

* .

* WireMock.Net.RestClient.AwesomeAssertions (#1427)

* WireMock.Net.RestClient.AwesomeAssertions

* ok

* atpath

* fix test

* sonar fixes

* ports

* proxy test

* FIX?

* ---

* await Task.Delay(100, _ct);

* ?

* --project

* Aspire: use IDistributedApplicationEventingSubscriber (#1428)

* broadcast

* ok

* more tsts

* .

* Collection

* up

* .

* 2

* remove nfluent

* <VersionPrefix>2.0.0-preview-02</VersionPrefix>

* ...

* .

* nuget icon

* .

* <PackageReference Include="JmesPath.Net" Version="1.1.0" />

* x

* 500

* .

* fix some warnings

* ws
This commit is contained in:
Stef Heyenrath
2026-03-11 17:02:47 +01:00
committed by GitHub
parent d6e19532bc
commit a292f28dda
521 changed files with 79740 additions and 5246 deletions

View File

@@ -1,15 +1,12 @@
// Copyright © WireMock.Net
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using NFluent;
using WireMock.Http;
using WireMock.Models;
using WireMock.Types;
using WireMock.Util;
using Xunit;
namespace WireMock.Net.Tests.Http;
@@ -17,6 +14,8 @@ public class HttpRequestMessageHelperTests
{
private const string ClientIp = "::1";
private readonly CancellationToken _ct = TestContext.Current.CancellationToken;
[Fact]
public void HttpRequestMessageHelper_Create()
{
@@ -28,7 +27,7 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(message.Headers.GetValues("x")).ContainsExactly("value-1");
message.Headers.GetValues("x").Should().Equal(new[] { "value-1" });
}
[Fact]
@@ -46,7 +45,7 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(await message.Content!.ReadAsByteArrayAsync().ConfigureAwait(false)).ContainsExactly(Encoding.UTF8.GetBytes("hi"));
(await message.Content!.ReadAsByteArrayAsync(_ct)).Should().Equal(Encoding.UTF8.GetBytes("hi"));
}
[Fact]
@@ -64,7 +63,7 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(await message.Content!.ReadAsStringAsync().ConfigureAwait(false)).Equals("0123");
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("0123");
}
[Fact]
@@ -82,7 +81,7 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(await message.Content!.ReadAsStringAsync().ConfigureAwait(false)).Equals("{\"x\":42}");
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
}
[Fact]
@@ -101,8 +100,8 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(await message.Content!.ReadAsStringAsync().ConfigureAwait(false)).Equals("{\"x\":42}");
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/json");
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/json" });
}
[Fact]
@@ -121,8 +120,8 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(await message.Content!.ReadAsStringAsync().ConfigureAwait(false)).Equals("{\"x\":42}");
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/json; charset=utf-8");
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/json; charset=utf-8" });
}
[Fact]
@@ -142,8 +141,8 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(await message.Content!.ReadAsStringAsync().ConfigureAwait(false)).Equals("{\"x\":42}");
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("multipart/form-data");
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "multipart/form-data" });
}
@@ -163,7 +162,7 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(message.Content!.Headers.GetValues("Content-Type")).ContainsExactly("application/xml");
message.Content!.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/xml" });
}
[Fact]
@@ -182,7 +181,7 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(message.Content!.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=UTF-8");
message.Content!.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/xml; charset=UTF-8" });
}
[Fact]
@@ -201,7 +200,7 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(message.Content!.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=Ascii");
message.Content!.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/xml; charset=Ascii" });
}
[Fact]
@@ -242,8 +241,8 @@ public class HttpRequestMessageHelperTests
var message = HttpRequestMessageHelper.Create(request, "http://url");
// Assert
Check.That(await message.Content!.ReadAsStringAsync().ConfigureAwait(false)).Equals(body);
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("multipart/form-data");
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be(body);
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "multipart/form-data" });
}
[Theory]
@@ -270,4 +269,7 @@ public class HttpRequestMessageHelperTests
// Assert
message.Content?.Headers.ContentLength.Should().Be(resultShouldBe ? value : null);
}
}
}