mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-17 15:46:46 +01:00
cleanup some #if for NETSTANDARD1_3
This commit is contained in:
@@ -44,18 +44,16 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentBuilder" Version="0.12.0">
|
||||
<PackageReference Include="FluentBuilder" Version="0.13.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Polyfill" Version="8.8.0">
|
||||
|
||||
<!-- Keep at 6.14.0 -->
|
||||
<PackageReference Include="Polyfill" Version="6.14.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<!--<PackageReference Include="PolySharp" Version="1.15.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>-->
|
||||
</ItemGroup>
|
||||
|
||||
<!--<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) and '$(TargetFramework)' != 'netstandard1.0'">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
@@ -112,4 +112,4 @@ internal class AzureADAuthenticationMatcher : IStringMatcher
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if NET451 || NET452 || NET46 || NET461 || NET48 || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
#if NET48
|
||||
using System.Text.RegularExpressions;
|
||||
using WireMock.Constants;
|
||||
|
||||
|
||||
@@ -56,10 +56,10 @@ internal static class HttpClientBuilder
|
||||
}
|
||||
}
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
|
||||
ServicePointManager.ServerCertificateValidationCallback = (message, cert, chain, errors) => true;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
return HttpClientFactory2.Create(handler);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ using WireMock.Models;
|
||||
using Stef.Validation;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Util;
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
using Wmhelp.XPath2;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
namespace WireMock.Matchers;
|
||||
|
||||
@@ -151,18 +151,18 @@ public class XPathMatcher : IStringMatcher
|
||||
var xmlNamespaceManager = GetXmlNamespaceManager(xmlNamespaceMap);
|
||||
if (xmlNamespaceManager == null)
|
||||
{
|
||||
#if NETSTANDARD1_3
|
||||
return navigator.Evaluate(xpath);
|
||||
#else
|
||||
//#if NETSTANDARD1_3
|
||||
//return navigator.Evaluate(xpath);
|
||||
//#else
|
||||
return navigator.XPath2Evaluate(xpath);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
#if NETSTANDARD1_3
|
||||
return navigator.Evaluate(xpath, xmlNamespaceManager);
|
||||
#else
|
||||
//#if NETSTANDARD1_3
|
||||
//return navigator.Evaluate(xpath, xmlNamespaceManager);
|
||||
//#else
|
||||
return navigator.XPath2Evaluate(xpath, xmlNamespaceManager);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
private XmlNamespaceManager? GetXmlNamespaceManager(IEnumerable<XmlNamespace>? xmlNamespaceMap)
|
||||
|
||||
@@ -136,17 +136,17 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
|
||||
#if NET8_0
|
||||
_logger.Info("Server using .NET 8.0");
|
||||
#elif NET48
|
||||
_logger.Info("Server using .NET Framework 4.6.1 or higher");
|
||||
_logger.Info("Server using .NET Framework 4.8");
|
||||
#endif
|
||||
|
||||
#if NETSTANDARD1_3
|
||||
return Task.Run(() =>
|
||||
{
|
||||
_host.Run(token);
|
||||
});
|
||||
#else
|
||||
//#if NETSTANDARD1_3
|
||||
// return Task.Run(() =>
|
||||
// {
|
||||
// _host.Run(token);
|
||||
// });
|
||||
//#else
|
||||
return _host.RunAsync(token);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -541,15 +541,15 @@ public partial class WireMockServer : IWireMockServer
|
||||
Guard.NotNull(tenant);
|
||||
Guard.NotNull(audience);
|
||||
|
||||
#if NETSTANDARD1_3
|
||||
throw new NotSupportedException("AzureADAuthentication is not supported for NETStandard 1.3");
|
||||
#else
|
||||
//#if NETSTANDARD1_3
|
||||
// throw new NotSupportedException("AzureADAuthentication is not supported for NETStandard 1.3");
|
||||
//#else
|
||||
_options.AuthenticationMatcher = new AzureADAuthenticationMatcher(
|
||||
new System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler(),
|
||||
new Microsoft.IdentityModel.Protocols.ConfigurationManager<Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfiguration>($"https://login.microsoftonline.com/{tenant}/.well-known/openid-configuration", new Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever()),
|
||||
tenant,
|
||||
audience);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWireMockServer.SetBasicAuthentication(string, string)" />
|
||||
|
||||
@@ -24,7 +24,7 @@ internal static class WireMockHandlebarsHelpers
|
||||
GetBaseDirectory(),
|
||||
};
|
||||
|
||||
#if !NETSTANDARD1_3_OR_GREATER
|
||||
//#if !NETSTANDARD1_3_OR_GREATER
|
||||
void Add(string? path, ICollection<string> customHelperPaths)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
@@ -36,7 +36,7 @@ internal static class WireMockHandlebarsHelpers
|
||||
Add(Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location), paths);
|
||||
Add(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), paths);
|
||||
Add(Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule?.FileName), paths);
|
||||
#endif
|
||||
//#endif
|
||||
o.CustomHelperPaths = paths;
|
||||
|
||||
o.CustomHelpers = new Dictionary<string, IHelpers>();
|
||||
@@ -49,7 +49,7 @@ internal static class WireMockHandlebarsHelpers
|
||||
|
||||
private static string GetBaseDirectory()
|
||||
{
|
||||
#if NETSTANDARD1_3_OR_GREATER || NET6_0_OR_GREATER
|
||||
#if NET8_0_OR_GREATER
|
||||
return AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar);
|
||||
#else
|
||||
return AppDomain.CurrentDomain.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar);
|
||||
|
||||
@@ -18,12 +18,12 @@ internal static class CultureInfoUtils
|
||||
|
||||
try
|
||||
{
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
if (int.TryParse(value, out var culture))
|
||||
{
|
||||
return new CultureInfo(culture);
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
if (string.Equals(value, nameof(CultureInfo.CurrentCulture), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return CultureInfo.CurrentCulture;
|
||||
|
||||
@@ -37,9 +37,9 @@ internal static class PortUtils
|
||||
}
|
||||
finally
|
||||
{
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
portSocket.Close();
|
||||
#endif
|
||||
//#endif
|
||||
portSocket.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -75,9 +75,9 @@ internal static class PortUtils
|
||||
{
|
||||
foreach (var socket in sockets)
|
||||
{
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
socket.Close();
|
||||
#endif
|
||||
//#endif
|
||||
socket.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,13 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Polyfill" Version="8.8.0">
|
||||
|
||||
<!-- Keep at 6.14.0 -->
|
||||
<PackageReference Include="Polyfill" Version="6.14.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
<PackageReference Include="RamlToOpenApiConverter.SourceOnly" Version="0.9.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.19.1" />
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace WireMock.RegularExpressions;
|
||||
/// <summary>
|
||||
/// Extension to the <see cref="Regex"/> object, adding support for GUID tokens for matching on.
|
||||
/// </summary>
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
[Serializable]
|
||||
#endif
|
||||
//#endif
|
||||
internal class RegexExtended : Regex
|
||||
{
|
||||
/// <inheritdoc cref="Regex"/>
|
||||
@@ -32,7 +32,7 @@ internal class RegexExtended : Regex
|
||||
{
|
||||
}
|
||||
|
||||
#if !NETSTANDARD1_3 && !NET8_0_OR_GREATER
|
||||
#if !NET8_0_OR_GREATER
|
||||
/// <inheritdoc cref="Regex"/>
|
||||
protected RegexExtended(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :
|
||||
base(info, context)
|
||||
|
||||
@@ -23,9 +23,9 @@ internal static class CompressionUtils
|
||||
using var zipStream = Create(contentEncoding, compressedStream, CompressionMode.Compress);
|
||||
zipStream.Write(data, 0, data.Length);
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
zipStream.Close();
|
||||
#endif
|
||||
//#endif
|
||||
return compressedStream.ToArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -142,16 +142,16 @@ internal static class TypeLoader
|
||||
|
||||
private static bool TryFindTypeInDlls<TInterface>(string? implementationTypeFullName, [NotNullWhen(true)] out Type? pluginType) where TInterface : class
|
||||
{
|
||||
#if NETSTANDARD1_3
|
||||
var directoriesToSearch = new[] { AppContext.BaseDirectory };
|
||||
#else
|
||||
//#if NETSTANDARD1_3
|
||||
// var directoriesToSearch = new[] { AppContext.BaseDirectory };
|
||||
//#else
|
||||
var processDirectory = Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule?.FileName);
|
||||
var assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
var directoriesToSearch = new[] { processDirectory, assemblyDirectory }
|
||||
.Where(d => !string.IsNullOrEmpty(d))
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
#endif
|
||||
//#endif
|
||||
foreach (var directory in directoriesToSearch)
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(directory!, "*.dll"))
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
</PropertyGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Polyfill" Version="8.8.0">
|
||||
<!-- Keep at 6.14.0 -->
|
||||
<PackageReference Include="Polyfill" Version="6.14.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
//using System.Xml;
|
||||
using NFluent;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -12,9 +12,9 @@ using Xunit;
|
||||
using Moq;
|
||||
using WireMock.Handlers;
|
||||
using FluentAssertions;
|
||||
#if !NETSTANDARD1_3
|
||||
using Wmhelp.XPath2;
|
||||
#endif
|
||||
//#if !NETSTANDARD1_3
|
||||
//using Wmhelp.XPath2;
|
||||
//#endif
|
||||
|
||||
namespace WireMock.Net.Tests.ResponseBuilders;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||
|
||||
// Assert
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("<response>abc</response>");
|
||||
@@ -85,7 +85,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualTo("abc");
|
||||
@@ -113,7 +113,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||
|
||||
// Assert
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("<response>abc,def,xyz</response>");
|
||||
@@ -169,7 +169,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||
|
||||
// Assert
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("<response>0000083256</response>");
|
||||
@@ -197,7 +197,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualIgnoringCase("True");
|
||||
@@ -225,7 +225,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualTo("a1");
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CultureInfoUtilsTests
|
||||
result.Should().Be(expectedCulture);
|
||||
}
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
//#if !NETSTANDARD1_3
|
||||
[Fact]
|
||||
public void Parse_IntegerInput_ReturnsExpectedCultureInfo()
|
||||
{
|
||||
@@ -53,7 +53,7 @@ public class CultureInfoUtilsTests
|
||||
// Assert
|
||||
result.Should().Be(expectedCulture);
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
[Fact]
|
||||
public void Parse_CurrentCultureInput_ReturnsCurrentCulture()
|
||||
|
||||
Reference in New Issue
Block a user