mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-24 01:08:28 +02:00
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:
@@ -1,14 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Util;
|
||||
|
||||
@@ -31,14 +26,14 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// Assert
|
||||
Check.That(body.BodyAsBytes).IsNotNull();
|
||||
Check.That(body.BodyAsJson).IsNotNull();
|
||||
Check.That(body.BodyAsString).Equals(bodyAsJson);
|
||||
Check.That(body.DetectedBodyType).IsEqualTo(detectedBodyType);
|
||||
Check.That(body.DetectedBodyTypeFromContentType).IsEqualTo(detectedBodyTypeFromContentType);
|
||||
body.BodyAsBytes.Should().NotBeNull();
|
||||
body.BodyAsJson.Should().NotBeNull();
|
||||
body.BodyAsString.Should().Be(bodyAsJson);
|
||||
body.DetectedBodyType.Should().Be(detectedBodyType);
|
||||
body.DetectedBodyTypeFromContentType.Should().Be(detectedBodyTypeFromContentType);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -55,14 +50,14 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// Assert
|
||||
Check.That(body.BodyAsBytes).IsNotNull();
|
||||
Check.That(body.BodyAsJson).IsNull();
|
||||
Check.That(body.BodyAsString).Equals(bodyAsString);
|
||||
Check.That(body.DetectedBodyType).IsEqualTo(detectedBodyType);
|
||||
Check.That(body.DetectedBodyTypeFromContentType).IsEqualTo(detectedBodyTypeFromContentType);
|
||||
body.BodyAsBytes.Should().NotBeNull();
|
||||
body.BodyAsJson.Should().BeNull();
|
||||
body.BodyAsString.Should().Be(bodyAsString);
|
||||
body.DetectedBodyType.Should().Be(detectedBodyType);
|
||||
body.DetectedBodyTypeFromContentType.Should().Be(detectedBodyTypeFromContentType);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -80,10 +75,10 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// act
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// assert
|
||||
Check.That(body.DetectedBodyType).IsEqualTo(detectedBodyType);
|
||||
body.DetectedBodyType.Should().Be(detectedBodyType);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -101,10 +96,10 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// act
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// assert
|
||||
Check.That(body.DetectedBodyType).IsEqualTo(detectedBodyType);
|
||||
body.DetectedBodyType.Should().Be(detectedBodyType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -142,14 +137,14 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// Assert
|
||||
Check.That(result.DetectedBodyType).IsEqualTo(BodyType.String);
|
||||
Check.That(result.DetectedBodyTypeFromContentType).IsEqualTo(BodyType.MultiPart);
|
||||
Check.That(result.BodyAsBytes).IsNotNull();
|
||||
Check.That(result.BodyAsJson).IsNull();
|
||||
Check.That(result.BodyAsString).IsNotNull();
|
||||
result.DetectedBodyType.Should().Be(BodyType.String);
|
||||
result.DetectedBodyTypeFromContentType.Should().Be(BodyType.MultiPart);
|
||||
result.BodyAsBytes.Should().NotBeNull();
|
||||
result.BodyAsJson.Should().BeNull();
|
||||
result.BodyAsString.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -166,14 +161,14 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// Assert
|
||||
Check.That(result.DetectedBodyType).IsEqualTo(BodyType.Bytes);
|
||||
Check.That(result.DetectedBodyTypeFromContentType).IsEqualTo(BodyType.MultiPart);
|
||||
Check.That(result.BodyAsBytes).IsNotNull();
|
||||
Check.That(result.BodyAsJson).IsNull();
|
||||
Check.That(result.BodyAsString).IsNull();
|
||||
result.DetectedBodyType.Should().Be(BodyType.Bytes);
|
||||
result.DetectedBodyTypeFromContentType.Should().Be(BodyType.MultiPart);
|
||||
result.BodyAsBytes.Should().NotBeNull();
|
||||
result.BodyAsJson.Should().BeNull();
|
||||
result.BodyAsString.Should().BeNull();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -189,14 +184,14 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var body = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// Assert
|
||||
Check.That(body.BodyAsBytes).IsNotNull();
|
||||
Check.That(body.BodyAsJson).IsNull();
|
||||
Check.That(body.BodyAsString).Equals(bodyAsString);
|
||||
Check.That(body.DetectedBodyType).IsEqualTo(detectedBodyType);
|
||||
Check.That(body.DetectedBodyTypeFromContentType).IsEqualTo(detectedBodyTypeFromContentType);
|
||||
body.BodyAsBytes.Should().NotBeNull();
|
||||
body.BodyAsJson.Should().BeNull();
|
||||
body.BodyAsString.Should().Be(bodyAsString);
|
||||
body.DetectedBodyType.Should().Be(detectedBodyType);
|
||||
body.DetectedBodyTypeFromContentType.Should().Be(detectedBodyTypeFromContentType);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -217,7 +212,7 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// Assert
|
||||
result.DetectedBodyType.Should().Be(BodyType.String);
|
||||
@@ -246,7 +241,7 @@ public class BodyParserTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
|
||||
var result = await BodyParser.ParseAsync(bodyParserSettings);
|
||||
|
||||
// Assert
|
||||
result.BodyAsBytes.Should().BeEquivalentTo(compressed);
|
||||
@@ -265,7 +260,7 @@ public class BodyParserTests
|
||||
[InlineData("PATCH", true)]
|
||||
public void BodyParser_ShouldParseBodyForMethodAndAllowAllIsFalse_ExpectedResultForKnownMethods(string method, bool resultShouldBe)
|
||||
{
|
||||
Check.That(BodyParser.ShouldParseBody(method, false)).Equals(resultShouldBe);
|
||||
BodyParser.ShouldParseBody(method, false).Should().Be(resultShouldBe);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -282,7 +277,7 @@ public class BodyParserTests
|
||||
[InlineData("SOME-UNKNOWN-METHOD")]
|
||||
public void BodyParser_ShouldParseBodyForMethodAndAllowAllIsTrue_ExpectedResultShouldBeTrue(string method)
|
||||
{
|
||||
Check.That(BodyParser.ShouldParseBody(method, true)).IsTrue();
|
||||
BodyParser.ShouldParseBody(method, true).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -290,6 +285,7 @@ public class BodyParserTests
|
||||
[InlineData("SOME-UNKNOWN-METHOD")]
|
||||
public void BodyParser_ShouldParseBody_DefaultIsTrueForUnknownMethods(string method)
|
||||
{
|
||||
Check.That(BodyParser.ShouldParseBody(method, false)).IsTrue();
|
||||
BodyParser.ShouldParseBody(method, false).Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user