mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-14 07:33:33 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c548600dea | ||
|
|
7f640dfa0d | ||
|
|
4b3e9feca0 | ||
|
|
4aaed2a6ca | ||
|
|
6f73dfe360 | ||
|
|
f4103b47aa | ||
|
|
edab3ad7e5 | ||
|
|
38c2131472 | ||
|
|
3693d6a676 |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,3 +1,16 @@
|
||||
# 1.6.9 (06 December 2024)
|
||||
- [#1216](https://github.com/WireMock-Net/WireMock.Net/pull/1216) - Fix JsonPartialMatcher when using property names with dot [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1210](https://github.com/WireMock-Net/WireMock.Net/issues/1210) - JsonPartialMatcher fails to match on property name that JsonMatcher matches [bug]
|
||||
|
||||
# 1.6.8 (24 November 2024)
|
||||
- [#1202](https://github.com/WireMock-Net/WireMock.Net/pull/1202) - Log exception when (static) mapping file cannot be read [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1206](https://github.com/WireMock-Net/WireMock.Net/pull/1206) - Fix security issues [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1211](https://github.com/WireMock-Net/WireMock.Net/pull/1211) - Use GraphQL 8.2.1 [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1213](https://github.com/WireMock-Net/WireMock.Net/pull/1213) - Fix HandlebarsContext ParseAndEvaluate method [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1201](https://github.com/WireMock-Net/WireMock.Net/issues/1201) - Mapping file parse errors are not logged to the console [feature]
|
||||
- [#1209](https://github.com/WireMock-Net/WireMock.Net/issues/1209) - Upgrade of GraphQL libs to the latest [feature]
|
||||
- [#1212](https://github.com/WireMock-Net/WireMock.Net/issues/1212) - Response Body Does Not Include Text After Path Segment [bug]
|
||||
|
||||
# 1.6.7 (17 October 2024)
|
||||
- [#1161](https://github.com/WireMock-Net/WireMock.Net/pull/1161) - Use latest ProtoBufJsonConverter to support WellKnownTypes [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1190](https://github.com/WireMock-Net/WireMock.Net/pull/1190) - Bump System.Text.Json from 8.0.4 to 8.0.5 in /examples/WireMock.Net.Console.Net472.Classic [dependencies] contributed by [dependabot[bot]](https://github.com/apps/dependabot)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.6.7</VersionPrefix>
|
||||
<VersionPrefix>1.6.9</VersionPrefix>
|
||||
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
||||
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
@@ -43,11 +43,17 @@
|
||||
</When>
|
||||
</Choose>
|
||||
|
||||
<PropertyGroup>
|
||||
<NuGetAudit>true</NuGetAudit>
|
||||
<!--<NuGetAuditLevel>low</NuGetAuditLevel>-->
|
||||
<NuGetAuditMode>all</NuGetAuditMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- CVE-2019-0820 -->
|
||||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" PrivateAssets="All" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
rem https://github.com/StefH/GitHubReleaseNotes
|
||||
|
||||
SET version=1.6.7
|
||||
SET version=1.6.9
|
||||
|
||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels test question invalid doc duplicate example environment --version %version% --token %GH_TOKEN%
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
# 1.6.7 (17 October 2024)
|
||||
- #1161 Use latest ProtoBufJsonConverter to support WellKnownTypes [bug]
|
||||
- #1190 Bump System.Text.Json from 8.0.4 to 8.0.5 in /examples/WireMock.Net.Console.Net472.Classic [dependencies]
|
||||
- #1194 Upgrade System.Text.RegularExpressions to 4.3.1 to solve CVE-2019-0820 [bug]
|
||||
- #1197 Bump System.Text.Json from 8.0.4 to 8.0.5 in /src/dotnet-WireMock.Net [dependencies]
|
||||
- #1198 Fix Google.Protobuf.WellKnownTypes.Value [bug]
|
||||
- #1144 Using google.protobuf.Empty as response results in a bad gRPC response [bug]
|
||||
- #1153 Grpc support for multiple proto files [feature]
|
||||
- #1193 Snyk issue : Regular Expression Denial of Service [bug]
|
||||
# 1.6.9 (06 December 2024)
|
||||
- #1216 Fix JsonPartialMatcher when using property names with dot [bug]
|
||||
- #1210 JsonPartialMatcher fails to match on property name that JsonMatcher matches [bug]
|
||||
|
||||
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
||||
@@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8F890C6F-9ACC-438D-928A-AD61CDA862F2}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0BB8B634-407A-4610-A91F-11586990767A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
test\Directory.Build.props = test\Directory.Build.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net", "src\WireMock.Net\WireMock.Net.csproj", "{D3804228-91F4-4502-9595-39584E5A01AD}"
|
||||
EndProject
|
||||
|
||||
@@ -51,10 +51,10 @@ public interface IWireMockLogger
|
||||
/// <summary>
|
||||
/// Writes the message at the Error level using the specified exception.
|
||||
/// </summary>
|
||||
/// <param name="formatString">The format string.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
[PublicAPI]
|
||||
void Error(string formatString, Exception exception);
|
||||
void Error(string message, Exception exception);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the LogEntryModel (LogRequestModel, LogResponseModel and more).
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Description>Commonly used models, enumerations and types.</Description>
|
||||
<AssemblyTitle>WireMock.Net.Abstractions</AssemblyTitle>
|
||||
<Authors>Stef Heyenrath</Authors>
|
||||
<TargetFrameworks>net45;net451;net461;netstandard1.0;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
<TargetFrameworks>net45;net451;net461;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591;8603</NoWarn>
|
||||
<AssemblyName>WireMock.Net.Abstractions</AssemblyName>
|
||||
@@ -36,15 +36,18 @@
|
||||
|
||||
<ItemGroup>
|
||||
<!-- See also https://mstack.nl/blog/20210801-source-generators -->
|
||||
<PackageReference Include="FluentBuilder" Version="0.9.0">
|
||||
<PackageReference Include="FluentBuilder" Version="0.10.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
<PackageReference Include="PolySharp" Version="1.14.0">
|
||||
<PackageReference Include="PolySharp" Version="1.14.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
<!-- CVE-2018-8292 -->
|
||||
<PackageReference Include="System.Net.Http " Version="4.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) and '$(TargetFramework)' != 'netstandard1.0'">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspire.Hosting" Version="8.2.0" />
|
||||
<PackageReference Include="Aspire.Hosting" Version="8.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="RamlToOpenApiConverter" Version="0.6.1" />
|
||||
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.17" />
|
||||
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.18" />
|
||||
<PackageReference Include="Stef.Validation" Version="0.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Description>A RestClient using RestEase to access the admin interface.</Description>
|
||||
<AssemblyTitle>WireMock.Net.RestClient</AssemblyTitle>
|
||||
<Authors>Stef Heyenrath</Authors>
|
||||
<TargetFrameworks>net45;netstandard1.1;netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
<TargetFrameworks>net45;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<AssemblyName>WireMock.Net.RestClient</AssemblyName>
|
||||
<PackageId>WireMock.Net.RestClient</PackageId>
|
||||
@@ -30,8 +30,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.3.0" />
|
||||
<PackageReference Include="RestEase" Version="1.5.7" />
|
||||
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.7.0" />
|
||||
<PackageReference Include="RestEase" Version="1.6.4" />
|
||||
<PackageReference Include="Stef.Validation" Version="0.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Stef.Validation" Version="0.1.1" />
|
||||
<PackageReference Include="TUnit.Core" Version="0.1.817" />
|
||||
<PackageReference Include="TUnit.Core" Version="0.2.195" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Stef.Validation" Version="0.1.1" />
|
||||
<PackageReference Include="Testcontainers" Version="3.10.0" />
|
||||
<PackageReference Include="Testcontainers" Version="4.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Description>Some extensions for xUnit (ITestOutputHelper)</Description>
|
||||
<AssemblyTitle>WireMock.Net.xUnit</AssemblyTitle>
|
||||
<Authors>Stef Heyenrath</Authors>
|
||||
<TargetFrameworks>net45;net451;netstandard1.0;netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
<TargetFrameworks>net45;net451;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<AssemblyName>WireMock.Net.xUnit</AssemblyName>
|
||||
<RootNamespace>WireMock.Net.Xunit</RootNamespace>
|
||||
|
||||
@@ -52,15 +52,15 @@ public class WireMockConsoleLogger : IWireMockLogger
|
||||
}
|
||||
|
||||
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
||||
public void Error(string formatString, Exception exception)
|
||||
public void Error(string message, Exception exception)
|
||||
{
|
||||
Console.WriteLine(Format("Error", formatString, exception.Message));
|
||||
Console.WriteLine(Format("Error", $"{message} {{0}}", exception));
|
||||
|
||||
if (exception is AggregateException ae)
|
||||
{
|
||||
ae.Handle(ex =>
|
||||
{
|
||||
Console.WriteLine(Format("Error", "Exception {0}", ex.Message));
|
||||
Console.WriteLine(Format("Error", "Exception {0}", ex));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class WireMockNullLogger : IWireMockLogger
|
||||
}
|
||||
|
||||
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
||||
public void Error(string formatString, Exception exception)
|
||||
public void Error(string message, Exception exception)
|
||||
{
|
||||
// Log nothing
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public abstract class AbstractJsonPartialMatcher : JsonMatcher
|
||||
case JTokenType.Object:
|
||||
var nestedValues = value.ToObject<Dictionary<string, JToken>>();
|
||||
return nestedValues?.Any() != true ||
|
||||
nestedValues.All(pair => IsMatch(pair.Value, input.SelectToken(pair.Key)));
|
||||
nestedValues.All(pair => IsMatch(pair.Value, input.SelectToken(pair.Key) ?? input[pair.Key])); // First try to select based on JPath expression, else just get the value.
|
||||
|
||||
case JTokenType.Array:
|
||||
var valuesArray = value.ToObject<JToken[]>();
|
||||
|
||||
@@ -113,16 +113,16 @@ public class GraphQLMatcher : IStringMatcher
|
||||
{
|
||||
try
|
||||
{
|
||||
var executionResult = new DocumentExecuter().ExecuteAsync(_ =>
|
||||
var executionResult = new DocumentExecuter().ExecuteAsync(eo =>
|
||||
{
|
||||
_.ThrowOnUnhandledException = true;
|
||||
eo.ThrowOnUnhandledException = true;
|
||||
|
||||
_.Schema = _schema;
|
||||
_.Query = graphQLRequest.Query;
|
||||
eo.Schema = _schema;
|
||||
eo.Query = graphQLRequest.Query;
|
||||
|
||||
if (graphQLRequest.Variables != null)
|
||||
{
|
||||
_.Variables = new Inputs(graphQLRequest.Variables);
|
||||
eo.Variables = new Inputs(graphQLRequest.Variables);
|
||||
}
|
||||
}).GetAwaiter().GetResult();
|
||||
|
||||
|
||||
@@ -178,9 +178,9 @@ public partial class WireMockServer
|
||||
{
|
||||
ReadStaticMappingAndAddOrUpdate(filename);
|
||||
}
|
||||
catch
|
||||
catch (Exception exception)
|
||||
{
|
||||
_settings.Logger.Error("Static MappingFile : '{0}' could not be read. This file will be skipped.", filename);
|
||||
_settings.Logger.Error($"Static MappingFile : '{filename}' could not be read. This file will be skipped.", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ internal class HandlebarsContext : IHandlebarsContext
|
||||
|
||||
public object? ParseAndEvaluate(string text, object model)
|
||||
{
|
||||
if (Handlebars.TryEvaluate(text, model, out var result) && result is not UndefinedBindingResult)
|
||||
if (text.StartsWith("{{") && text.EndsWith("}}") &&
|
||||
Handlebars.TryEvaluate(text, model, out var result) &&
|
||||
result is not UndefinedBindingResult)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -59,13 +59,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JsonConverter.Abstractions" Version="0.5.0" />
|
||||
<PackageReference Include="JsonConverter.Abstractions" Version="0.7.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NJsonSchema.Extensions" Version="0.1.0" />
|
||||
<PackageReference Include="NSwag.Core" Version="13.16.1" />
|
||||
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
||||
<PackageReference Include="JmesPath.Net" Version="1.0.125" />
|
||||
<PackageReference Include="AnyOf" Version="0.3.0" />
|
||||
<PackageReference Include="JmesPath.Net" Version="1.0.330" />
|
||||
<PackageReference Include="AnyOf" Version="0.4.0" />
|
||||
<PackageReference Include="TinyMapper" Version="3.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -108,9 +108,6 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
<!-- https://github.com/WireMock-Net/WireMock.Net/issues/697 -->
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="4.7.2" />
|
||||
|
||||
<!-- https://github.com/WireMock-Net/WireMock.Net/issues/507 -->
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.6" />
|
||||
</ItemGroup>
|
||||
@@ -147,8 +144,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' and '$(TargetFramework)' != 'net461'">
|
||||
<PackageReference Include="GraphQL" Version="7.5.0" />
|
||||
<PackageReference Include="GraphQL.NewtonsoftJson" Version="7.5.0" />
|
||||
<PackageReference Include="GraphQL.NewtonsoftJson" Version="8.2.1" />
|
||||
<PackageReference Include="MimeKitLite" Version="4.1.0.1" />
|
||||
<PackageReference Include="ProtoBufJsonConverter" Version="0.5.0" />
|
||||
</ItemGroup>
|
||||
@@ -192,6 +188,11 @@
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xslt" Version="2.4.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- CVE-2021-26701 and https://github.com/WireMock-Net/WireMock.Net/issues/697 -->
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="4.7.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\WireMock.Org.Abstractions\WireMock.Org.Abstractions.csproj" />
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AnyOf" Version="0.3.0" />
|
||||
<PackageReference Include="RestEase" Version="1.5.7" />
|
||||
<PackageReference Include="AnyOf" Version="0.4.0" />
|
||||
<PackageReference Include="RestEase" Version="1.6.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -47,9 +47,9 @@ public class WireMockLogger : IWireMockLogger
|
||||
}
|
||||
|
||||
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
||||
public void Error(string formatString, Exception exception)
|
||||
public void Error(string message, Exception exception)
|
||||
{
|
||||
_logger.LogError(exception, formatString);
|
||||
_logger.LogError(exception, message);
|
||||
}
|
||||
|
||||
/// <see cref="IWireMockLogger.DebugRequestResponse"/>
|
||||
|
||||
8
test/Directory.Build.props
Normal file
8
test/Directory.Build.props
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project>
|
||||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' != 'net45' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net461' ">
|
||||
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -18,7 +18,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.0" />
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspire.Hosting.Testing" Version="8.2.0" />
|
||||
<PackageReference Include="Aspire.Hosting.Testing" Version="8.2.2" />
|
||||
<PackageReference Include="Codecov" Version="1.13.0" />
|
||||
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TUnit" Version="0.1.817" />
|
||||
<PackageReference Include="TUnit" Version="0.2.195" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -107,22 +107,32 @@ public class GraphQLMatcherTests
|
||||
public void GraphQLMatcher_For_ValidSchema_And_CorrectGraphQL_UsingCustomType_Mutation_IsMatch()
|
||||
{
|
||||
// Arrange
|
||||
const string testSchema = @"
|
||||
scalar DateTime
|
||||
scalar MyCustomScalar
|
||||
// Query is provided here: https://stackoverflow.com/questions/59608833/apollo-graphql-error-query-root-type-must-be-provided
|
||||
const string testSchema =
|
||||
"""
|
||||
scalar DateTime
|
||||
scalar MyCustomScalar
|
||||
|
||||
type Query {
|
||||
_empty: String
|
||||
}
|
||||
|
||||
type Message {
|
||||
id: ID!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createMessage(x: MyCustomScalar, dt: DateTime): Message
|
||||
}
|
||||
""";
|
||||
|
||||
type Message {
|
||||
id: ID!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createMessage(x: MyCustomScalar, dt: DateTime): Message
|
||||
}";
|
||||
|
||||
var input = @"{
|
||||
""query"": ""mutation CreateMessage($x: MyCustomScalar!, $dt: DateTime!) { createMessage(x: $x, dt: $dt) { id } }"",
|
||||
""variables"": { ""x"": 100, ""dt"": ""2007-12-03T10:15:30Z"" }
|
||||
}";
|
||||
const string input =
|
||||
"""
|
||||
{
|
||||
"query": "mutation CreateMessage($x: MyCustomScalar!, $dt: DateTime!) { createMessage(x: $x, dt: $dt) { id } }",
|
||||
"variables": { "x": 100, "dt": "2007-12-03T10:15:30Z" }
|
||||
}
|
||||
""";
|
||||
|
||||
var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(int) } };
|
||||
|
||||
|
||||
@@ -293,6 +293,23 @@ public class JsonPartialMatcherTests
|
||||
Assert.Equal(1.0, match);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonPartialMatcher_IsMatch_JObjectAsStringWithDottedPropertyName()
|
||||
{
|
||||
// Assign
|
||||
var matcher = new JsonPartialMatcher("{ \"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User\" : \"Test\" }");
|
||||
|
||||
// Act
|
||||
var jObject = new JObject
|
||||
{
|
||||
{ "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User", new JValue("Test") }
|
||||
};
|
||||
var match = matcher.IsMatch(jObject).Score;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1.0, match);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonPartialMatcher_IsMatch_GuidAsString()
|
||||
{
|
||||
|
||||
@@ -130,6 +130,29 @@ public class ResponseWithTransformerTests
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("a wiremock");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("{{request.PathSegments.[0]}}", "a")]
|
||||
[InlineData("prefix_{{request.PathSegments.[0]}}", "prefix_a")]
|
||||
[InlineData("{{request.PathSegments.[0]}}_postfix", "a_postfix")]
|
||||
[InlineData("prefix_{{request.PathSegments.[0]}}_postfix", "prefix_a_postfix")]
|
||||
public async Task Response_ProvideResponse_Handlebars_BodyAsJson_PathSegments(string field, string expected)
|
||||
{
|
||||
// Assign
|
||||
var urlDetails = UrlUtils.Parse(new Uri("http://localhost/wiremock/a/b"), new PathString("/wiremock"));
|
||||
var request = new RequestMessage(urlDetails, "POST", ClientIp);
|
||||
|
||||
var responseBuilder = Response.Create()
|
||||
.WithBodyAsJson(new { field })
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
var json = (JObject)response.Message.BodyData!.BodyAsJson!;
|
||||
Check.That(json["field"]!.Value<string>()).Equals(expected);
|
||||
}
|
||||
|
||||
[Theory(Skip = "Invalid token `OpenBracket`")]
|
||||
[InlineData(TransformerType.Scriban)]
|
||||
[InlineData(TransformerType.ScribanDotLiquid)]
|
||||
|
||||
@@ -72,10 +72,10 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Moq" Version="4.17.2" />
|
||||
<PackageReference Include="System.Threading" Version="4.3.0" />
|
||||
<PackageReference Include="RestEase" Version="1.5.7" />
|
||||
<PackageReference Include="RestEase" Version="1.6.4" />
|
||||
<PackageReference Include="NFluent" Version="2.8.0" />
|
||||
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
||||
<PackageReference Include="AnyOf" Version="0.3.0" />
|
||||
<PackageReference Include="AnyOf" Version="0.4.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -104,8 +104,7 @@
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net452'">
|
||||
<PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
|
||||
<PackageReference Include="JsonConverter.System.Text.Json" Version="0.5.0" />
|
||||
|
||||
<PackageReference Include="JsonConverter.System.Text.Json" Version="0.7.0" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.60.0">
|
||||
|
||||
Reference in New Issue
Block a user