mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-30 22:32:56 +02:00
WireMock.Net.FluentAssertions : upgrade to latest FluentAssertions (#635)
* . * #634 * fix UT
This commit is contained in:
@@ -107,6 +107,7 @@
|
|||||||
- [#549](https://github.com/WireMock-Net/WireMock.Net/issues/549) - WithProxy(...) does not save the mappings to file [bug]
|
- [#549](https://github.com/WireMock-Net/WireMock.Net/issues/549) - WithProxy(...) does not save the mappings to file [bug]
|
||||||
|
|
||||||
# 1.3.8 (03 December 2020)
|
# 1.3.8 (03 December 2020)
|
||||||
|
- [#539](https://github.com/WireMock-Net/WireMock.Net/pull/539) - Support for partial JSON matching contributed by [gleb-osokin](https://github.com/gleb-osokin)
|
||||||
- [#542](https://github.com/WireMock-Net/WireMock.Net/pull/542) - Create dotnet-wiremock tool [feature] contributed by [StefH](https://github.com/StefH)
|
- [#542](https://github.com/WireMock-Net/WireMock.Net/pull/542) - Create dotnet-wiremock tool [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#543](https://github.com/WireMock-Net/WireMock.Net/pull/543) - Add support for .NET 5 [feature] contributed by [StefH](https://github.com/StefH)
|
- [#543](https://github.com/WireMock-Net/WireMock.Net/pull/543) - Add support for .NET 5 [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#544](https://github.com/WireMock-Net/WireMock.Net/pull/544) - Use Java 11 in Azure Pipelines (needed for SonarCloud) [feature] contributed by [StefH](https://github.com/StefH)
|
- [#544](https://github.com/WireMock-Net/WireMock.Net/pull/544) - Use Java 11 in Azure Pipelines (needed for SonarCloud) [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
@@ -114,9 +115,6 @@
|
|||||||
- [#547](https://github.com/WireMock-Net/WireMock.Net/pull/547) - Fix Proxying with SSL and NetCoreApp3.1 [bug] contributed by [StefH](https://github.com/StefH)
|
- [#547](https://github.com/WireMock-Net/WireMock.Net/pull/547) - Fix Proxying with SSL and NetCoreApp3.1 [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#524](https://github.com/WireMock-Net/WireMock.Net/issues/524) - Proxying with SSL Not Working in .NET Core 3.1 [bug]
|
- [#524](https://github.com/WireMock-Net/WireMock.Net/issues/524) - Proxying with SSL Not Working in .NET Core 3.1 [bug]
|
||||||
|
|
||||||
# 1.3.7 (17 November 2020)
|
|
||||||
- [#539](https://github.com/WireMock-Net/WireMock.Net/pull/539) - Support for partial JSON matching contributed by [gleb-osokin](https://github.com/gleb-osokin)
|
|
||||||
|
|
||||||
# 1.3.6 (10 November 2020)
|
# 1.3.6 (10 November 2020)
|
||||||
- [#529](https://github.com/WireMock-Net/WireMock.Net/pull/529) - Add assertions for ClientIP, Url and ProxyUrl [feature] contributed by [akamud](https://github.com/akamud)
|
- [#529](https://github.com/WireMock-Net/WireMock.Net/pull/529) - Add assertions for ClientIP, Url and ProxyUrl [feature] contributed by [akamud](https://github.com/akamud)
|
||||||
- [#535](https://github.com/WireMock-Net/WireMock.Net/pull/535) - WithCallback should use also use enum HttpStatusCode [bug] contributed by [StefH](https://github.com/StefH)
|
- [#535](https://github.com/WireMock-Net/WireMock.Net/pull/535) - WithCallback should use also use enum HttpStatusCode [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>1.4.22</VersionPrefix>
|
<VersionPrefix>1.4.23</VersionPrefix>
|
||||||
<PackageReleaseNotes>See CHANGELOG.md</PackageReleaseNotes>
|
<PackageReleaseNotes>See CHANGELOG.md</PackageReleaseNotes>
|
||||||
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
||||||
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
rem https://github.com/StefH/GitHubReleaseNotes
|
rem https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
SET version=1.4.22
|
SET version=1.4.23
|
||||||
|
|
||||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version%
|
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version% --token %GH_TOKEN%
|
||||||
|
|
||||||
GitHubReleaseNotes --output PackageReleaseNotes.txt --skip-empty-releases --exclude-labels question invalid doc duplicate --template PackageReleaseNotes.template --version %version%
|
GitHubReleaseNotes --output PackageReleaseNotes.txt --skip-empty-releases --exclude-labels question invalid doc duplicate --template PackageReleaseNotes.template --version %version% --token %GH_TOKEN%
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# 1.4.21 (16 September 2021)
|
# 1.4.22 (22 September 2021)
|
||||||
- #631 Add WireMock.org RestClient [feature]
|
- #633 Implement Random Delay [feature]
|
||||||
|
|
||||||
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
||||||
@@ -36,7 +36,7 @@ namespace WireMock.FluentAssertions
|
|||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string value, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string value, string because = "", params object[] becauseArgs)
|
||||||
=> WithHeader(expectedKey, new[] {value}, because, becauseArgs);
|
=> WithHeader(expectedKey, new[] { value }, because, becauseArgs);
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
||||||
@@ -69,7 +69,7 @@ namespace WireMock.FluentAssertions
|
|||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
return new AndConstraint<WireMockAssertions>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> AtUrl(string url, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> AtUrl(string url, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
@@ -85,10 +85,10 @@ namespace WireMock.FluentAssertions
|
|||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but didn't find it among the calls to {1}.",
|
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but didn't find it among the calls to {1}.",
|
||||||
_ => url, requests => requests.Select(request => request.Url));
|
_ => url, requests => requests.Select(request => request.Url));
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
return new AndConstraint<WireMockAssertions>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> WithProxyUrl(string proxyUrl, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> WithProxyUrl(string proxyUrl, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
@@ -104,10 +104,10 @@ namespace WireMock.FluentAssertions
|
|||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but didn't find it among the calls with {1}.",
|
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but didn't find it among the calls with {1}.",
|
||||||
_ => proxyUrl, requests => requests.Select(request => request.ProxyUrl));
|
_ => proxyUrl, requests => requests.Select(request => request.ProxyUrl));
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
return new AndConstraint<WireMockAssertions>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> FromClientIP(string clientIP, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> FromClientIP(string clientIP, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
@@ -123,7 +123,7 @@ namespace WireMock.FluentAssertions
|
|||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but didn't find it among the calls from IP(s) {1}.",
|
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but didn't find it among the calls from IP(s) {1}.",
|
||||||
_ => clientIP, requests => requests.Select(request => request.ClientIP));
|
_ => clientIP, requests => requests.Select(request => request.ClientIP));
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
return new AndConstraint<WireMockAssertions>(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,23 +4,39 @@ using WireMock.Server;
|
|||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace WireMock.FluentAssertions
|
namespace WireMock.FluentAssertions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains a number of methods to assert that the <see cref="IWireMockServer"/> is in the expected state.
|
||||||
|
/// </summary>
|
||||||
public class WireMockReceivedAssertions : ReferenceTypeAssertions<IWireMockServer, WireMockReceivedAssertions>
|
public class WireMockReceivedAssertions : ReferenceTypeAssertions<IWireMockServer, WireMockReceivedAssertions>
|
||||||
{
|
{
|
||||||
public WireMockReceivedAssertions(IWireMockServer server)
|
/// <summary>
|
||||||
|
/// Create a WireMockReceivedAssertions.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="server">The <see cref="IWireMockServer"/>.</param>
|
||||||
|
public WireMockReceivedAssertions(IWireMockServer server) : base(server)
|
||||||
{
|
{
|
||||||
Subject = server;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Asserts if <see cref="IWireMockServer"/> has received a call.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><see cref="WireMockAssertions"/></returns>
|
||||||
public WireMockAssertions HaveReceivedACall()
|
public WireMockAssertions HaveReceivedACall()
|
||||||
{
|
{
|
||||||
return new WireMockAssertions(Subject, null);
|
return new WireMockAssertions(Subject, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Asserts if <see cref="IWireMockServer"/> has received n-calls.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="callsCount"></param>
|
||||||
|
/// <returns><see cref="WireMockAssertions"/></returns>
|
||||||
public WireMockANumberOfCallsAssertions HaveReceived(int callsCount)
|
public WireMockANumberOfCallsAssertions HaveReceived(int callsCount)
|
||||||
{
|
{
|
||||||
return new WireMockANumberOfCallsAssertions(Subject, callsCount);
|
return new WireMockANumberOfCallsAssertions(Subject, callsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected override string Identifier => "wiremockserver";
|
protected override string Identifier => "wiremockserver";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>FluentAssertions extensions for WireMock.Net</Description>
|
<Description>FluentAssertions extensions for WireMock.Net</Description>
|
||||||
@@ -29,13 +29,20 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
|
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net451' or '$(TargetFramework)' == 'netstandard1.3'">
|
||||||
|
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'netstandard1.3'">
|
||||||
|
<PackageReference Include="FluentAssertions" Version="6.1.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
<ProjectReference Include="..\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
using FluentAssertions;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using FluentAssertions;
|
||||||
|
using WireMock.FluentAssertions;
|
||||||
using WireMock.RequestBuilders;
|
using WireMock.RequestBuilders;
|
||||||
using WireMock.ResponseBuilders;
|
using WireMock.ResponseBuilders;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
using Xunit;
|
|
||||||
using WireMock.FluentAssertions;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
|
using Xunit;
|
||||||
using static System.Environment;
|
using static System.Environment;
|
||||||
|
|
||||||
namespace WireMock.Net.Tests.FluentAssertions
|
namespace WireMock.Net.Tests.FluentAssertions
|
||||||
@@ -100,16 +100,9 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
.HaveReceivedACall()
|
.HaveReceivedACall()
|
||||||
.WithHeader("Authorization", "value");
|
.WithHeader("Authorization", "value");
|
||||||
|
|
||||||
var sentHeaders = _server.LogEntries.SelectMany(x => x.RequestMessage.Headers)
|
|
||||||
.ToDictionary(x => x.Key, x => x.Value)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var sentHeaderString = "{" + string.Join(", ", sentHeaders) + "}";
|
|
||||||
|
|
||||||
act.Should().Throw<Exception>()
|
act.Should().Throw<Exception>()
|
||||||
.And.Message.Should()
|
.And.Message.Should()
|
||||||
.Be(
|
.Contain("to contain key \"Authorization\".");
|
||||||
$"Expected headers from requests sent {sentHeaderString} to contain key \"Authorization\".{NewLine}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -156,7 +149,7 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
.And.Message.Should()
|
.And.Message.Should()
|
||||||
.Be($"{string.Join(NewLine, missingValue1Message, missingValue2Message)}{NewLine}");
|
.Be($"{string.Join(NewLine, missingValue1Message, missingValue2Message)}{NewLine}");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task AtUrl_WhenACallWasMadeToUrl_Should_BeOK()
|
public async Task AtUrl_WhenACallWasMadeToUrl_Should_BeOK()
|
||||||
{
|
{
|
||||||
@@ -200,7 +193,7 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
{
|
{
|
||||||
_server.ResetMappings();
|
_server.ResetMappings();
|
||||||
_server.Given(Request.Create().UsingAnyMethod())
|
_server.Given(Request.Create().UsingAnyMethod())
|
||||||
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings {Url = "http://localhost:9999"}));
|
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings { Url = "http://localhost:9999" }));
|
||||||
|
|
||||||
await _httpClient.GetAsync("");
|
await _httpClient.GetAsync("");
|
||||||
|
|
||||||
@@ -214,8 +207,8 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
{
|
{
|
||||||
_server.ResetMappings();
|
_server.ResetMappings();
|
||||||
_server.Given(Request.Create().UsingAnyMethod())
|
_server.Given(Request.Create().UsingAnyMethod())
|
||||||
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings {Url = "http://localhost:9999"}));
|
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings { Url = "http://localhost:9999" }));
|
||||||
|
|
||||||
Action act = () => _server.Should()
|
Action act = () => _server.Should()
|
||||||
.HaveReceivedACall()
|
.HaveReceivedACall()
|
||||||
.WithProxyUrl("anyurl");
|
.WithProxyUrl("anyurl");
|
||||||
@@ -231,8 +224,8 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
{
|
{
|
||||||
_server.ResetMappings();
|
_server.ResetMappings();
|
||||||
_server.Given(Request.Create().UsingAnyMethod())
|
_server.Given(Request.Create().UsingAnyMethod())
|
||||||
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings {Url = "http://localhost:9999"}));
|
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings { Url = "http://localhost:9999" }));
|
||||||
|
|
||||||
await _httpClient.GetAsync("");
|
await _httpClient.GetAsync("");
|
||||||
|
|
||||||
Action act = () => _server.Should()
|
Action act = () => _server.Should()
|
||||||
@@ -244,7 +237,7 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
.Be(
|
.Be(
|
||||||
$"Expected _server to have been called with proxy url \"anyurl\", but didn't find it among the calls with {{\"http://localhost:9999\"}}.");
|
$"Expected _server to have been called with proxy url \"anyurl\", but didn't find it among the calls with {{\"http://localhost:9999\"}}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task FromClientIP_whenACallWasMadeFromClientIP_Should_BeOK()
|
public async Task FromClientIP_whenACallWasMadeFromClientIP_Should_BeOK()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
@@ -139,7 +139,7 @@ namespace WireMock.Net.Tests.ResponseBuilders
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
response.Message.BodyData.BodyAsString.Should().Be("/fooBar");
|
response.Message.BodyData.BodyAsString.Should().Be("/fooBar");
|
||||||
response.Message.StatusCode.Should().Be(HttpStatusCode.Accepted);
|
response.Message.StatusCode.Should().Be((int) HttpStatusCode.Accepted);
|
||||||
response.Message.Headers[header].Should().ContainSingle("Stef");
|
response.Message.Headers[header].Should().ContainSingle("Stef");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using HandlebarsDotNet;
|
using HandlebarsDotNet;
|
||||||
@@ -216,7 +216,7 @@ namespace WireMock.Net.Tests.ResponseBuilders
|
|||||||
Func<Task> a = async () => await responseBuilder.ProvideResponseAsync(request, _settings);
|
Func<Task> a = async () => await responseBuilder.ProvideResponseAsync(request, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
a.Should().Throw<HandlebarsException>();
|
a.Should().ThrowAsync<HandlebarsException>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -243,7 +243,7 @@ namespace WireMock.Net.Tests.ResponseBuilders
|
|||||||
Func<Task> a = async () => await responseBuilder.ProvideResponseAsync(request, _settings);
|
Func<Task> a = async () => await responseBuilder.ProvideResponseAsync(request, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
a.Should().Throw<HandlebarsException>();
|
a.Should().ThrowAsync<HandlebarsException>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,105 +1,109 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Stef Heyenrath</Authors>
|
<Authors>Stef Heyenrath</Authors>
|
||||||
<TargetFrameworks>net452;net461;netcoreapp3.1;net5.0</TargetFrameworks>
|
<TargetFrameworks>net452;net461;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<AssemblyName>WireMock.Net.Tests</AssemblyName>
|
<AssemblyName>WireMock.Net.Tests</AssemblyName>
|
||||||
<PackageId>WireMock.Net.Tests</PackageId>
|
<PackageId>WireMock.Net.Tests</PackageId>
|
||||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||||
<ProjectGuid>{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}</ProjectGuid>
|
<ProjectGuid>{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}</ProjectGuid>
|
||||||
|
|
||||||
<!--<SonarQubeTestProject>True</SonarQubeTestProject>
|
<!--<SonarQubeTestProject>True</SonarQubeTestProject>
|
||||||
<SonarQubeExclude>True</SonarQubeExclude>-->
|
<SonarQubeExclude>True</SonarQubeExclude>-->
|
||||||
|
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>../../src/WireMock.Net/WireMock.Net.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>../../src/WireMock.Net/WireMock.Net.snk</AssemblyOriginatorKeyFile>
|
||||||
<!--<DelaySign>true</DelaySign>-->
|
<!--<DelaySign>true</DelaySign>-->
|
||||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||||
|
|
||||||
<!--https://developercommunity.visualstudio.com/content/problem/26347/unit-tests-fail-with-fileloadexception-newtonsoftj-1.html-->
|
<!--https://developercommunity.visualstudio.com/content/problem/26347/unit-tests-fail-with-fileloadexception-newtonsoftj-1.html-->
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net.FluentAssertions\WireMock.Net.FluentAssertions.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net.FluentAssertions\WireMock.Net.FluentAssertions.csproj" />
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net.Matchers.CSharpCode\WireMock.Net.Matchers.CSharpCode.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net.Matchers.CSharpCode\WireMock.Net.Matchers.CSharpCode.csproj" />
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net.RestClient\WireMock.Net.RestClient.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net.RestClient\WireMock.Net.RestClient.csproj" />
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Codecov" Version="1.10.0" />
|
<PackageReference Include="Codecov" Version="1.10.0" />
|
||||||
<PackageReference Include="coverlet.msbuild" Version="3.0.2">
|
<PackageReference Include="coverlet.msbuild" Version="3.0.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.0.2">
|
<PackageReference Include="coverlet.collector" Version="3.0.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
||||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
<PackageReference Include="Moq" Version="4.16.0" />
|
||||||
<PackageReference Include="Moq" Version="4.16.0" />
|
<PackageReference Include="System.Threading" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Threading" Version="4.3.0" />
|
<PackageReference Include="RestEase" Version="1.5.5" />
|
||||||
<PackageReference Include="RestEase" Version="1.5.5" />
|
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.12" />
|
||||||
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.12" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="NFluent" Version="2.7.1" />
|
||||||
<PackageReference Include="NFluent" Version="2.7.1" />
|
<!--<PackageReference Include="OpenCover" Version="4.7.922" />-->
|
||||||
<!--<PackageReference Include="OpenCover" Version="4.7.922" />-->
|
<!--<PackageReference Include="ReportGenerator" Version="4.8.1" />-->
|
||||||
<!--<PackageReference Include="ReportGenerator" Version="4.8.1" />-->
|
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
||||||
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.12" />
|
||||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.12" />
|
<!--<PackageReference Include="StrongNamer" Version="0.0.8" />-->
|
||||||
<!--<PackageReference Include="StrongNamer" Version="0.0.8" />-->
|
</ItemGroup>
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
|
<ItemGroup Condition="'$(TargetFramework)' == 'net452' or '$(TargetFramework)' == 'net461'">
|
||||||
<PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="3.1.0" />
|
<PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="3.1.0" />
|
||||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net461'">
|
||||||
<None Update="responsebody.json">
|
<PackageReference Include="FluentAssertions" Version="6.1.0" />
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
</ItemGroup>
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings.org\mapping1.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings\00000002-ee28-4f29-ae63-1ac9b0802d86.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings\00000002-ee28-4f29-ae63-1ac9b0802d87.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings\351f0240-bba0-4bcb-93c6-1feba0fe8799.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings\array.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings\documentdb_root.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings\MyXmlResponse.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="__admin\mappings\subdirectory\MyXmlResponse.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
<None Update="responsebody.json">
|
||||||
</ItemGroup>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings.org\mapping1.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings\00000002-ee28-4f29-ae63-1ac9b0802d86.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings\00000002-ee28-4f29-ae63-1ac9b0802d87.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings\351f0240-bba0-4bcb-93c6-1feba0fe8799.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings\array.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings\documentdb_root.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings\MyXmlResponse.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="__admin\mappings\subdirectory\MyXmlResponse.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -691,7 +691,7 @@ namespace WireMock.Net.Tests
|
|||||||
var result = await new HttpClient(httpClientHandler).SendAsync(requestMessage);
|
var result = await new HttpClient(httpClientHandler).SendAsync(requestMessage);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.StatusCode.Should().Be(500);
|
result.StatusCode.Should().Be(HttpStatusCode.InternalServerError);
|
||||||
|
|
||||||
var content = await result.Content.ReadAsStringAsync();
|
var content = await result.Content.ReadAsStringAsync();
|
||||||
content.Should().NotBeEmpty();
|
content.Should().NotBeEmpty();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
@@ -31,7 +31,7 @@ namespace WireMock.Net.Tests
|
|||||||
var response = await httpClient.PostAsync("http://localhost:" + server.Ports[0] + "/foo", new StringContent("dummy"));
|
var response = await httpClient.PostAsync("http://localhost:" + server.Ports[0] + "/foo", new StringContent("dummy"));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
response.StatusCode.Should().Be(409);
|
response.StatusCode.Should().Be(HttpStatusCode.Conflict);
|
||||||
|
|
||||||
server.Stop();
|
server.Stop();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user