This commit is contained in:
Stef Heyenrath
2026-02-26 18:44:06 +01:00
parent 868fd6abf5
commit 5c437450a1
21 changed files with 83 additions and 94 deletions

View File

@@ -4,7 +4,7 @@
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>2.0.0-preview-02</VersionPrefix>
<VersionPrefix>2.0.0-preview-01</VersionPrefix>
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
<PackageProjectUrl>https://github.com/wiremock/WireMock.Net</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>

View File

@@ -16,7 +16,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="WireMock.Net" Version="1.12.0" />
<PackageReference Include="WireMock.Net" Version="1.25.0" />
</ItemGroup>
</Project>

View File

@@ -201,7 +201,6 @@ public static class Program
.WithGuid(broadcastMappingGuid)
.RespondWith(Response.Create()
.WithWebSocket(ws => ws
.WithBroadcast()
.WithMessageHandler(async (message, context) =>
{
if (message.MessageType == WebSocketMessageType.Text)
@@ -423,7 +422,6 @@ public static class Program
.WithGuid(broadcastGuid)
.RespondWith(Response.Create()
.WithWebSocket(ws => ws
.WithBroadcast()
.WithMessageHandler(async (message, context) =>
{
if (message.MessageType == WebSocketMessageType.Text)

View File

@@ -1,26 +1,25 @@
// Copyright © WireMock.Net
namespace WireMock.Admin.Mappings
namespace WireMock.Admin.Mappings;
/// <summary>
/// EncodingModel
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class EncodingModel
{
/// <summary>
/// EncodingModel
/// Encoding CodePage
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class EncodingModel
{
/// <summary>
/// Encoding CodePage
/// </summary>
public int CodePage { get; set; }
public int CodePage { get; set; }
/// <summary>
/// Encoding EncodingName
/// </summary>
public string EncodingName { get; set; }
/// <summary>
/// Encoding EncodingName
/// </summary>
public required string EncodingName { get; set; }
/// <summary>
/// Encoding WebName
/// </summary>
public string WebName { get; set; }
}
/// <summary>
/// Encoding WebName
/// </summary>
public required string WebName { get; set; }
}

View File

@@ -1,6 +1,5 @@
// Copyright © WireMock.Net
using System;
using WireMock.Models;
namespace WireMock.Admin.Mappings;
@@ -65,12 +64,12 @@ public class MappingModel
/// <summary>
/// The request model.
/// </summary>
public RequestModel Request { get; set; }
public required RequestModel Request { get; set; }
/// <summary>
/// The response model.
/// </summary>
public ResponseModel Response { get; set; }
public required ResponseModel Response { get; set; }
/// <summary>
/// Saves this mapping as a static mapping file.

View File

@@ -13,7 +13,7 @@ public class LogRequestModel
/// <summary>
/// The Client IP Address.
/// </summary>
public string ClientIP { get; set; }
public required string ClientIP { get; set; }
/// <summary>
/// The DateTime.
@@ -23,22 +23,22 @@ public class LogRequestModel
/// <summary>
/// The Path.
/// </summary>
public string Path { get; set; }
public required string Path { get; set; }
/// <summary>
/// The Absolute Path.
/// </summary>
public string AbsolutePath { get; set; }
public required string AbsolutePath { get; set; }
/// <summary>
/// Gets the url (relative).
/// </summary>
public string Url { get; set; }
public required string Url { get; set; }
/// <summary>
/// The absolute URL.
/// </summary>
public string AbsoluteUrl { get; set; }
public required string AbsoluteUrl { get; set; }
/// <summary>
/// The ProxyUrl (if a proxy is used).
@@ -53,7 +53,7 @@ public class LogRequestModel
/// <summary>
/// The method.
/// </summary>
public string Method { get; set; }
public required string Method { get; set; }
/// <summary>
/// The HTTP Version.

View File

@@ -1,36 +1,35 @@
// Copyright © WireMock.Net
namespace WireMock.Admin.Scenarios
namespace WireMock.Admin.Scenarios;
/// <summary>
/// ScenarioStateModel
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class ScenarioStateModel
{
/// <summary>
/// ScenarioStateModel
/// Gets or sets the name.
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class ScenarioStateModel
{
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; }
public required string Name { get; set; }
/// <summary>
/// Gets or sets the NextState.
/// </summary>
public string? NextState { get; set; }
/// <summary>
/// Gets or sets the NextState.
/// </summary>
public string? NextState { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ScenarioStateModel"/> is started.
/// </summary>
public bool Started { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ScenarioStateModel"/> is started.
/// </summary>
public bool Started { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ScenarioStateModel"/> is finished.
/// </summary>
public bool Finished { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ScenarioStateModel"/> is finished.
/// </summary>
public bool Finished { get; set; }
/// <summary>
/// Gets or sets the state counter.
/// </summary>
public int Counter { get; set; }
}
/// <summary>
/// Gets or sets the state counter.
/// </summary>
public int Counter { get; set; }
}

View File

@@ -39,7 +39,7 @@
</ItemGroup>-->
<ItemGroup>
<PackageReference Include="FluentBuilder" Version="0.13.0">
<PackageReference Include="FluentBuilder" Version="0.14.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@@ -1,7 +1,5 @@
// Copyright © WireMock.Net
using System.IO;
using System.Linq;
using Stef.Validation;
using WireMock.Settings;
@@ -10,7 +8,7 @@ namespace WireMock.Serialization;
/// <summary>
/// Creates sanitized file names for mappings
/// </summary>
public class MappingFileNameSanitizer
internal class MappingFileNameSanitizer
{
private const char ReplaceChar = '_';

View File

@@ -870,7 +870,7 @@ public partial class WireMockServer
throw new NotSupportedException();
}
private static T DeserializeObject<T>(IRequestMessage requestMessage) where T : new()
private static T DeserializeObject<T>(IRequestMessage requestMessage)
{
switch (requestMessage.BodyData?.DetectedBodyType)
{

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Minimal version from the lightweight Http Mocking Server for .NET</Description>
<AssemblyTitle>WireMock.Net.Minimal</AssemblyTitle>
@@ -37,9 +37,9 @@
</ItemGroup>
<ItemGroup>
<!--<PackageReference Include="JmesPath.Net.SourceOnly" Version="1.0.330-20260213.1" />-->
<PackageReference Include="JmesPath.Net" Version="1.0.330" />
<PackageReference Include="NJsonSchema.Extensions" Version="0.1.0" />
<PackageReference Include="JmesPath.Net.SourceOnly" Version="1.0.330-20260213.1" />
<!--<PackageReference Include="JmesPath.Net" Version="1.0.330" />-->
<PackageReference Include="NJsonSchema.Extensions" Version="0.2.0" />
<PackageReference Include="NSwag.Core" Version="13.16.1" />
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
<PackageReference Include="TinyMapper.Signed" Version="4.0.0" />
@@ -47,6 +47,12 @@
<PackageReference Include="Scriban.Signed" Version="5.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="JmesPath.Net.SourceOnly">
<NoWarn>CS1591;CS8618</NoWarn>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
@@ -56,18 +62,6 @@
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.3.9" />
</ItemGroup>
<PropertyGroup>
<!-- Suppress warnings from JmesPath source-only package -->
<!--<NoWarn>$(NoWarn);CS8600;CS8602;CS8603;CS8604;CS8619;CS8625;CS0649</NoWarn>-->
</PropertyGroup>
<!--<ItemGroup>
--><!-- Disable all warnings for JmesPath source-only package files --><!--
<Compile Update="**\jmespath.net.sourceonly\**\*.cs">
<NoWarn>$(NoWarn);CS0001-CS9999</NoWarn>
</Compile>
</ItemGroup>-->
<ItemGroup>
<Compile Update="Server\WireMockServer.*.cs">
<DependentUpon>WireMockServer.cs</DependentUpon>

View File

@@ -42,7 +42,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="RamlToOpenApiConverter.SourceOnly" Version="0.11.0" />
<PackageReference Include="YamlDotNet" Version="16.3.0" />
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.19" />
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.19.1" />
<PackageReference Include="Stef.Validation" Version="0.2.0" />
</ItemGroup>

View File

@@ -28,7 +28,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Stef.Validation" Version="0.2.0" />
<PackageReference Include="TUnit.Core" Version="1.13.60" />
<PackageReference Include="TUnit.Core" Version="1.17.29" />
</ItemGroup>
<ItemGroup>

View File

@@ -24,7 +24,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Stef.Validation" Version="0.2.0" />
<PackageReference Include="xunit.v3.extensibility.core" Version="3.2.0" />
<PackageReference Include="xunit.v3.extensibility.core" Version="3.2.2" />
</ItemGroup>
<ItemGroup>

View File

@@ -25,7 +25,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">

View File

@@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@@ -24,7 +24,7 @@
</PackageReference>
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">

View File

@@ -10,7 +10,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TUnit" Version="1.13.60" />
<PackageReference Include="TUnit" Version="1.17.29" />
</ItemGroup>
<ItemGroup>

View File

@@ -2,9 +2,9 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
@@ -15,7 +15,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="WireMock.Net" Version="1.25.0" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">

View File

@@ -12,8 +12,10 @@ using WireMock.Server;
// ReSharper disable once CheckNamespace
namespace WireMock.Net.Tests;
public partial class WireMockServerTests
public class WireMockServerTests
{
private readonly CancellationToken _ct = TestContext.Current.CancellationToken;
[Fact]
public async Task WireMockServer_WithMultiPartBody_Using_MimePartMatchers()
{
@@ -85,19 +87,19 @@ public partial class WireMockServerTests
var client = server.CreateClient();
// Act 1
var response1 = await client.PostAsync("/multipart", formDataContent);
var response1 = await client.PostAsync("/multipart", formDataContent, _ct);
// Assert 1
response1.StatusCode.Should().Be(HttpStatusCode.OK);
var content1 = await response1.Content.ReadAsStringAsync();
var content1 = await response1.Content.ReadAsStringAsync(_ct);
content1.Should().Be("POST;This is some plain text");
// Act 2
var response2 = await client.PostAsync("/multipart2", formDataContent);
var response2 = await client.PostAsync("/multipart2", formDataContent, _ct);
// Assert 1
response2.StatusCode.Should().Be(HttpStatusCode.OK);
var content2 = await response2.Content.ReadAsStringAsync();
var content2 = await response2.Content.ReadAsStringAsync(_ct);
content2.Should().Be("OK");
}
}

View File

@@ -62,13 +62,13 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Meziantou.Extensions.Logging.Xunit.v3" Version="1.1.23" />
<PackageReference Include="Meziantou.Extensions.Logging.Xunit.v3" Version="1.1.24" />
<PackageReference Include="Verify.XunitV3" Version="31.13.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>