mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-20 16:23:42 +01:00
Version 2.x
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' != 'net45' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net461' ">
|
||||
<ItemGroup Condition=" '$(TargetFramework)' != 'net48' ">
|
||||
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TUnit" Version="0.2.195" />
|
||||
<PackageReference Include="TUnit" Version="0.57.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -59,7 +59,7 @@ server
|
||||
)
|
||||
.WithGuid("c9929240-7ae8-4a5d-8ed8-0913479f6eeb")
|
||||
.RespondWith(Response.Create()
|
||||
.WithStatusCode(208)
|
||||
.WithStatusCode(306)
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
@as = 1,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
//#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -69,10 +69,10 @@ public partial class WireMockAdminApiTests
|
||||
.WithAuthorization(adminUsername, adminPassword);
|
||||
|
||||
// Act 1
|
||||
await api.WaitForHealthAsync().ConfigureAwait(false);
|
||||
await api.WaitForHealthAsync();
|
||||
|
||||
// Act 2
|
||||
var status = await api.GetHealthAsync().ConfigureAwait(false);
|
||||
var status = await api.GetHealthAsync();
|
||||
status.Should().Be("Healthy");
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act
|
||||
var settings = await api.GetSettingsAsync().ConfigureAwait(false);
|
||||
var settings = await api.GetSettingsAsync();
|
||||
Check.That(settings).IsNotNull();
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0] + "/foo");
|
||||
|
||||
// Act
|
||||
var settings = await api.GetSettingsAsync().ConfigureAwait(false);
|
||||
var settings = await api.GetSettingsAsync();
|
||||
|
||||
// Assert
|
||||
Check.That(settings).IsNotNull();
|
||||
@@ -137,7 +137,7 @@ public partial class WireMockAdminApiTests
|
||||
|
||||
// Act
|
||||
var settings = new SettingsModel();
|
||||
var status = await api.PostSettingsAsync(settings).ConfigureAwait(false);
|
||||
var status = await api.PostSettingsAsync(settings);
|
||||
Check.That(status.Status).Equals("Settings updated");
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public partial class WireMockAdminApiTests
|
||||
|
||||
// Act
|
||||
var settings = new SettingsModel();
|
||||
var status = await api.PutSettingsAsync(settings).ConfigureAwait(false);
|
||||
var status = await api.PutSettingsAsync(settings);
|
||||
Check.That(status.Status).Equals("Settings updated");
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public partial class WireMockAdminApiTests
|
||||
Priority = 500,
|
||||
Title = "test"
|
||||
};
|
||||
var result = await api.PutMappingAsync(new Guid("a0000000-0000-0000-0000-000000000000"), model).ConfigureAwait(false);
|
||||
var result = await api.PutMappingAsync(new Guid("a0000000-0000-0000-0000-000000000000"), model);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsNotNull();
|
||||
@@ -200,11 +200,11 @@ public partial class WireMockAdminApiTests
|
||||
.RespondWith(Response.Create());
|
||||
|
||||
var serverUrl = "http://localhost:" + server.Ports[0];
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo");
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var requests = await api.FindRequestsAsync(new RequestModel { Methods = new[] { "GET" } }).ConfigureAwait(false);
|
||||
var requests = await api.FindRequestsAsync(new RequestModel { Methods = new[] { "GET" } });
|
||||
|
||||
// Assert
|
||||
requests.Should().HaveCount(1);
|
||||
@@ -231,12 +231,12 @@ public partial class WireMockAdminApiTests
|
||||
|
||||
var serverUrl = "http://localhost:" + server.Ports[0];
|
||||
using var client = new HttpClient();
|
||||
await client.GetAsync(serverUrl + "/foo").ConfigureAwait(false);
|
||||
await client.GetAsync(serverUrl + "/foo?bar=baz").ConfigureAwait(false);
|
||||
await client.GetAsync(serverUrl + "/foo");
|
||||
await client.GetAsync(serverUrl + "/foo?bar=baz");
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var logEntryModels = await api.FindRequestsByMappingGuidAsync(mappingGuid).ConfigureAwait(false);
|
||||
var logEntryModels = await api.FindRequestsByMappingGuidAsync(mappingGuid);
|
||||
|
||||
// Assert
|
||||
logEntryModels.Should().HaveCount(2);
|
||||
@@ -270,11 +270,11 @@ public partial class WireMockAdminApiTests
|
||||
.RespondWith(Response.Create());
|
||||
|
||||
var serverUrl = "http://localhost:" + server.Ports[0];
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo");
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var logEntryModels = await api.FindRequestsByMappingGuidAsync(Guid.NewGuid()).ConfigureAwait(false);
|
||||
var logEntryModels = await api.FindRequestsByMappingGuidAsync(Guid.NewGuid());
|
||||
|
||||
// Assert
|
||||
logEntryModels.Should().BeEmpty();
|
||||
@@ -307,11 +307,11 @@ public partial class WireMockAdminApiTests
|
||||
Logger = new WireMockNullLogger()
|
||||
});
|
||||
var serverUrl = "http://localhost:" + server.Ports[0];
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo");
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var requests = await api.GetRequestsAsync().ConfigureAwait(false);
|
||||
var requests = await api.GetRequestsAsync();
|
||||
|
||||
// Assert
|
||||
Check.That(requests).HasSize(1);
|
||||
@@ -347,7 +347,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var requests = await api.GetRequestsAsync().ConfigureAwait(false);
|
||||
var requests = await api.GetRequestsAsync();
|
||||
|
||||
// Assert
|
||||
Check.That(requests).HasSize(1);
|
||||
@@ -384,7 +384,7 @@ public partial class WireMockAdminApiTests
|
||||
},
|
||||
Response = new ResponseModel { Body = "world" }
|
||||
};
|
||||
var postMappingResult = await api.PostMappingAsync(model).ConfigureAwait(false);
|
||||
var postMappingResult = await api.PostMappingAsync(model);
|
||||
|
||||
// Assert
|
||||
postMappingResult.Should().NotBeNull();
|
||||
@@ -392,7 +392,7 @@ public partial class WireMockAdminApiTests
|
||||
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
|
||||
mapping.Should().NotBeNull();
|
||||
|
||||
var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
|
||||
var getMappingResult = await api.GetMappingAsync(guid);
|
||||
|
||||
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
|
||||
|
||||
@@ -435,7 +435,7 @@ public partial class WireMockAdminApiTests
|
||||
}
|
||||
}
|
||||
};
|
||||
var postMappingResult = await api.PostMappingAsync(model).ConfigureAwait(false);
|
||||
var postMappingResult = await api.PostMappingAsync(model);
|
||||
|
||||
// Assert
|
||||
postMappingResult.Should().NotBeNull();
|
||||
@@ -443,7 +443,7 @@ public partial class WireMockAdminApiTests
|
||||
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
|
||||
mapping.Should().NotBeNull();
|
||||
|
||||
var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
|
||||
var getMappingResult = await api.GetMappingAsync(guid);
|
||||
|
||||
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
|
||||
|
||||
@@ -475,7 +475,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var requests = await api.GetRequestsAsync().ConfigureAwait(false);
|
||||
var requests = await api.GetRequestsAsync();
|
||||
|
||||
// Assert
|
||||
Check.That(requests).HasSize(1);
|
||||
@@ -504,7 +504,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act
|
||||
var request = await api.PostFileAsync("filename.txt", "abc").ConfigureAwait(false);
|
||||
var request = await api.PostFileAsync("filename.txt", "abc");
|
||||
|
||||
// Assert
|
||||
Check.That(request.Guid).IsNull();
|
||||
@@ -537,7 +537,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act
|
||||
var request = await api.PutFileAsync("filename.txt", "abc-abc").ConfigureAwait(false);
|
||||
var request = await api.PutFileAsync("filename.txt", "abc-abc");
|
||||
|
||||
// Assert
|
||||
Check.That(request.Guid).IsNull();
|
||||
@@ -568,7 +568,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatAsyncCode(() => api.PutFileAsync("filename.txt", "xxx")).Throws<ApiException>();
|
||||
Check.ThatCode(() => api.PutFileAsync("filename.txt", "xxx")).Throws<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -595,7 +595,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatAsyncCode(() => api.GetFileAsync("filename.txt")).Throws<ApiException>();
|
||||
Check.ThatCode(() => api.GetFileAsync("filename.txt")).Throws<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -623,7 +623,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act
|
||||
string file = await api.GetFileAsync("filename.txt").ConfigureAwait(false);
|
||||
string file = await api.GetFileAsync("filename.txt");
|
||||
|
||||
// Assert
|
||||
Check.That(file).Equals(data);
|
||||
@@ -654,7 +654,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act
|
||||
await api.DeleteFileAsync("filename.txt").ConfigureAwait(false);
|
||||
await api.DeleteFileAsync("filename.txt");
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -682,7 +682,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatAsyncCode(() => api.DeleteFileAsync("filename.txt")).Throws<ApiException>();
|
||||
Check.ThatCode(() => api.DeleteFileAsync("filename.txt")).Throws<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -708,7 +708,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatAsyncCode(() => api.FileExistsAsync("filename.txt")).Throws<ApiException>();
|
||||
Check.ThatCode(() => api.FileExistsAsync("filename.txt")).Throws<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -726,7 +726,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act
|
||||
var status = await api.DeleteScenarioAsync(name).ConfigureAwait(false);
|
||||
var status = await api.DeleteScenarioAsync(name);
|
||||
status.Status.Should().Be("No scenario found by name 'x'.");
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act
|
||||
var status = await api.ResetScenarioAsync(name).ConfigureAwait(false);
|
||||
var status = await api.ResetScenarioAsync(name);
|
||||
status.Status.Should().Be("No scenario found by name 'x'.");
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ public partial class WireMockAdminApiTests
|
||||
{
|
||||
State = null
|
||||
};
|
||||
var status = await api.PutScenarioStateAsync("x", update).ConfigureAwait(false);
|
||||
var status = await api.PutScenarioStateAsync("x", update);
|
||||
status.Status.Should().Be("No scenario found by name 'x'.");
|
||||
}
|
||||
|
||||
@@ -790,7 +790,7 @@ public partial class WireMockAdminApiTests
|
||||
{
|
||||
State = null
|
||||
};
|
||||
var status = await api.PutScenarioStateAsync("s1", update).ConfigureAwait(false);
|
||||
var status = await api.PutScenarioStateAsync("s1", update);
|
||||
status.Status.Should().Be("Scenario state set to ''");
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ public partial class WireMockAdminApiTests
|
||||
|
||||
// Act
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
|
||||
var getMappingResult = await api.GetMappingAsync(guid);
|
||||
|
||||
// Assert
|
||||
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
|
||||
@@ -852,10 +852,10 @@ public partial class WireMockAdminApiTests
|
||||
// Act
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
var mappings = await api.GetMappingsAsync().ConfigureAwait(false);
|
||||
var mappings = await api.GetMappingsAsync();
|
||||
mappings.Should().HaveCount(1);
|
||||
|
||||
var code = await api.GetMappingCodeAsync(guid).ConfigureAwait(false);
|
||||
var code = await api.GetMappingCodeAsync(guid);
|
||||
|
||||
// Assert
|
||||
await Verifier.Verify(code).DontScrubDateTimes().DontScrubGuids();
|
||||
@@ -942,7 +942,7 @@ public partial class WireMockAdminApiTests
|
||||
.WithGuid(guid5)
|
||||
.RespondWith(
|
||||
Response.Create()
|
||||
.WithStatusCode(HttpStatusCode.AlreadyReported)
|
||||
.WithStatusCode(HttpStatusCode.Unused)
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
@as = 1,
|
||||
@@ -974,10 +974,10 @@ text
|
||||
// Act
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
var mappings = await api.GetMappingsAsync().ConfigureAwait(false);
|
||||
var mappings = await api.GetMappingsAsync();
|
||||
mappings.Should().HaveCount(5);
|
||||
|
||||
var code = await api.GetMappingsCodeAsync().ConfigureAwait(false);
|
||||
var code = await api.GetMappingsCodeAsync();
|
||||
|
||||
// Assert
|
||||
await Verifier.Verify(code).DontScrubDateTimes().DontScrubGuids();
|
||||
@@ -989,13 +989,13 @@ text
|
||||
public async Task IWireMockAdminApi_OpenApiConvert_Yml()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore.yml"));
|
||||
var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore.yml"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument);
|
||||
|
||||
// Assert
|
||||
server.MappingModels.Should().BeEmpty();
|
||||
@@ -1008,13 +1008,13 @@ text
|
||||
public async Task IWireMockAdminApi_OpenApiConvert_Json()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
|
||||
var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument);
|
||||
|
||||
// Assert
|
||||
server.MappingModels.Should().BeEmpty();
|
||||
@@ -1027,13 +1027,13 @@ text
|
||||
public async Task IWireMockAdminApi_OpenApiSave_Json()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
|
||||
var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var statusModel = await api.OpenApiSaveAsync(openApiDocument).ConfigureAwait(false);
|
||||
var statusModel = await api.OpenApiSaveAsync(openApiDocument);
|
||||
|
||||
// Assert
|
||||
statusModel.Status.Should().Be("OpenApi document converted to Mappings");
|
||||
@@ -1046,13 +1046,13 @@ text
|
||||
public async Task IWireMockAdminApi_OpenApiSave_Yml()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore.yml"));
|
||||
var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore.yml"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument);
|
||||
|
||||
// Assert
|
||||
server.MappingModels.Should().BeEmpty();
|
||||
@@ -1069,7 +1069,7 @@ text
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var status = await api.ReloadStaticMappingsAsync().ConfigureAwait(false);
|
||||
var status = await api.ReloadStaticMappingsAsync();
|
||||
|
||||
// Assert
|
||||
status.Status.Should().Be("Static Mappings reloaded");
|
||||
@@ -1080,4 +1080,4 @@ text
|
||||
return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "__admin", "mappings", filename));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using WireMock.FluentAssertions;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if PROTOBUF
|
||||
//#if PROTOBUF
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@@ -18,8 +18,8 @@ public class ProtoBufUtilsTests
|
||||
public async Task GetProtoBufMessageWithHeader_MultipleProtoFiles()
|
||||
{
|
||||
// Arrange
|
||||
var greet = await ReadProtoFileAsync("greet1.proto");
|
||||
var request = await ReadProtoFileAsync("request.proto");
|
||||
var greet = ReadProtoFile("greet1.proto");
|
||||
var request = ReadProtoFile("request.proto");
|
||||
|
||||
// Act
|
||||
var responseBytes = await ProtoBufUtils.GetProtoBufMessageWithHeaderAsync(
|
||||
@@ -35,9 +35,9 @@ public class ProtoBufUtilsTests
|
||||
Convert.ToBase64String(responseBytes).Should().Be("AAAAAAcKBWhlbGxv");
|
||||
}
|
||||
|
||||
private static Task<string> ReadProtoFileAsync(string filename)
|
||||
private string ReadProtoFile(string filename)
|
||||
{
|
||||
return File.ReadAllTextAsync(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
|
||||
return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if PROTOBUF
|
||||
//#if PROTOBUF
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@@ -72,4 +72,4 @@ public class ProtoDefinitionHelperTests
|
||||
Convert.ToBase64String(responseBytes).Should().Be("AAAAAAcIARIDYWJj");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if PROTOBUF
|
||||
//#if PROTOBUF
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
@@ -501,7 +501,7 @@ message Other {
|
||||
public async Task WireMockServer_WithBodyAsProtoBuf_WithWellKnownTypes_Empty_UsingGrpcGeneratedClient()
|
||||
{
|
||||
// Arrange
|
||||
var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
|
||||
var definition = File.ReadAllText("./Grpc/greet.proto");
|
||||
|
||||
using var server = WireMockServer.Start(useHttp2: true);
|
||||
|
||||
@@ -534,7 +534,7 @@ message Other {
|
||||
// Arrange
|
||||
const int seconds = 1722301323;
|
||||
const int nanos = 12300;
|
||||
var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
|
||||
var definition = File.ReadAllText("./Grpc/greet.proto");
|
||||
|
||||
using var server = WireMockServer.Start(useHttp2: true);
|
||||
|
||||
@@ -575,7 +575,7 @@ message Other {
|
||||
// Arrange
|
||||
const int seconds = 1722301323;
|
||||
const int nanos = 12300;
|
||||
var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
|
||||
var definition = File.ReadAllText("./Grpc/greet.proto");
|
||||
|
||||
using var server = WireMockServer.Start(useHttp2: true);
|
||||
|
||||
@@ -614,7 +614,7 @@ message Other {
|
||||
public async Task WireMockServer_WithBodyAsProtoBuf_Enum_UsingGrpcGeneratedClient()
|
||||
{
|
||||
// Arrange
|
||||
var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
|
||||
var definition = File.ReadAllText("./Grpc/greet.proto");
|
||||
|
||||
using var server = WireMockServer.Start(useHttp2: true);
|
||||
|
||||
@@ -655,7 +655,7 @@ message Other {
|
||||
const int nanos = 12300;
|
||||
const string version = "test";
|
||||
const string correlationId = "correlation";
|
||||
var definition = await File.ReadAllTextAsync("./Grpc/policy.proto");
|
||||
var definition = File.ReadAllText("./Grpc/policy.proto");
|
||||
|
||||
using var server = WireMockServer.Start(useHttp2: true);
|
||||
|
||||
@@ -773,4 +773,4 @@ message Other {
|
||||
return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if MIMEKIT
|
||||
//#if MIMEKIT
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using WireMock.Matchers;
|
||||
@@ -100,4 +100,4 @@ public class MimePartMatcherTests
|
||||
result.Score.Should().Be(MatchScores.Perfect);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if GRAPHQL
|
||||
//#if GRAPHQL
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using WireMock.GraphQL.Models;
|
||||
@@ -95,4 +95,4 @@ public class WireMockCustomScalarGraphTypeTests
|
||||
result.Should().Be("someString");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
//#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@@ -40,7 +40,7 @@ public class WireMockOpenApiParserTests
|
||||
ExampleValues = _exampleValuesMock.Object
|
||||
};
|
||||
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "payroc-openapi-spec.yaml"));
|
||||
var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "payroc-openapi-spec.yaml"));
|
||||
|
||||
// Act
|
||||
var mappings = _sut.FromText(openApiDocument, settings, out _);
|
||||
@@ -58,7 +58,7 @@ public class WireMockOpenApiParserTests
|
||||
ExampleValues = _exampleValuesMock.Object
|
||||
};
|
||||
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "oas-content-example.json"));
|
||||
var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "oas-content-example.json"));
|
||||
|
||||
// Act
|
||||
var mappings = _sut.FromText(openApiDocument, settings, out _);
|
||||
@@ -67,4 +67,4 @@ public class WireMockOpenApiParserTests
|
||||
await Verifier.Verify(mappings);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -39,7 +39,7 @@ namespace WireMock.Net.Tests.Owin
|
||||
public void GlobalExceptionMiddleware_Invoke_NullAsNext_DoesNotInvokeNextAndDoesNotThrow()
|
||||
{
|
||||
// Act
|
||||
Check.ThatAsyncCode(() => _sut.Invoke(null)).DoesNotThrow();
|
||||
Check.ThatCode(() => _sut.Invoke(null)).DoesNotThrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if MIMEKIT
|
||||
//#if MIMEKIT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -178,4 +178,4 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
|
||||
return matcher.GetMatchingScore(requestMessage, result);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -105,7 +105,7 @@ public class ResponseWithHandlebarsFileTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<HandlebarsException>();
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<HandlebarsException>();
|
||||
|
||||
// Verify
|
||||
_filesystemHandlerMock.Verify(fs => fs.ReadResponseBodyAsString(It.IsAny<string>()), Times.Never);
|
||||
|
||||
@@ -350,7 +350,7 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<ArgumentNullException>();
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -162,7 +162,7 @@ public class ResponseWithHandlebarsLinqTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<ArgumentException>();
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<ArgumentException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -178,7 +178,7 @@ public class ResponseWithHandlebarsLinqTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<HandlebarsException>();
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<HandlebarsException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -120,6 +120,6 @@ public class ResponseWithHandlebarsRegexTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<ArgumentNullException>();
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<ArgumentNullException>();
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class ResponseWithProxyTests : IDisposable
|
||||
// Act
|
||||
var request = new RequestMessage(new UrlDetails($"{_server.Urls[0]}/{_guid}"), "GET", ClientIp);
|
||||
|
||||
Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<HttpRequestException>();
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws<HttpRequestException>();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -779,7 +779,7 @@ public class ResponseWithTransformerTests
|
||||
response.Message.BodyData.Encoding.Should().Be(enc);
|
||||
}
|
||||
|
||||
#if MIMEKIT
|
||||
//#if MIMEKIT
|
||||
[Theory]
|
||||
[InlineData(TransformerType.Handlebars)]
|
||||
// [InlineData(TransformerType.Scriban)]
|
||||
@@ -825,12 +825,12 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
|
||||
.WithTransformer(transformerType);
|
||||
|
||||
// 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("text/plain text/json image.png");
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
[Theory]
|
||||
[InlineData("/wiremock-data/1", "one")]
|
||||
|
||||
@@ -62,7 +62,7 @@ public class MatcherMapperTests
|
||||
models.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
#if MIMEKIT
|
||||
//#if MIMEKIT
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_Matcher_MimePartMatcher()
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class MatcherMapperTests
|
||||
model.ContentMatcher!.Name.Should().Be(nameof(ExactObjectMatcher));
|
||||
model.ContentMatcher.Pattern.Should().Be(bytes);
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_Matcher_IStringMatcher()
|
||||
@@ -598,7 +598,7 @@ message HelloReply {
|
||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.RejectOnMatch);
|
||||
}
|
||||
|
||||
#if MIMEKIT
|
||||
//#if MIMEKIT
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_MatcherModel_MimePartMatcher()
|
||||
{
|
||||
@@ -638,7 +638,7 @@ message HelloReply {
|
||||
matcher.ContentTransferEncodingMatcher.Should().BeAssignableTo<RegexMatcher>().Which.GetPatterns().Should().ContainSingle("z");
|
||||
matcher.ContentTypeMatcher.Should().BeAssignableTo<ContentTypeMatcher>().Which.GetPatterns().Should().ContainSingle("text/json");
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_MatcherModel_XPathMatcher_WithXmlNamespaces_As_String()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<Authors>Stef Heyenrath</Authors>
|
||||
<TargetFrameworks>net452;net461;net6.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net48;net8.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -21,15 +21,19 @@
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net452' or '$(TargetFramework)' == 'net461'">
|
||||
<!--<PropertyGroup Condition="'$(TargetFramework)' == 'net452' or '$(TargetFramework)' == 'net461'">
|
||||
<DefineConstants>NETFRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' and '$(TargetFramework)' != 'net461'">
|
||||
<DefineConstants>$(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF</DefineConstants>
|
||||
</PropertyGroup>-->
|
||||
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' ">
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' != 'net48' ">
|
||||
<DefineConstants>$(DefineConstants);TRAILINGHEADERS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -64,21 +68,40 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CultureAwareTesting.xUnit" Version="0.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.core" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CultureAwareTesting.xUnit" Version="0.0.1.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Moq" Version="4.17.2" />
|
||||
<PackageReference Include="System.Threading" Version="4.3.0" />
|
||||
<PackageReference Include="NFluent" Version="2.8.0" />
|
||||
<PackageReference Include="Moq" Version="4.20.72" />
|
||||
<!--<PackageReference Include="System.Threading" Version="4.3.0" />-->
|
||||
<PackageReference Include="NFluent" Version="3.1.0" />
|
||||
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
||||
<PackageReference Include="AnyOf" Version="0.4.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
|
||||
|
||||
<PackageReference Include="Verify.Xunit" Version="19.6.0" />
|
||||
<PackageReference Include="JsonConverter.System.Text.Json" Version="0.7.2" />
|
||||
<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">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
<Protobuf Include="Grpc\greet.proto" GrpcServices="Client" />
|
||||
<Protobuf Include="Grpc\policy.proto" GrpcServices="Client" />
|
||||
|
||||
<!--<PackageReference Include="AnyOf" Version="0.4.0" />-->
|
||||
<!--<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />-->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net452' or '$(TargetFramework)' == 'net461'">
|
||||
<!--<ItemGroup Condition="'$(TargetFramework)' == 'net452' or '$(TargetFramework)' == 'net461'">
|
||||
<PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="3.1.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||
@@ -99,9 +122,9 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Verify.Xunit" Version="19.6.0" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>-->
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net452'">
|
||||
<!--<ItemGroup Condition="'$(TargetFramework)' != 'net452'">
|
||||
<PackageReference Include="System.Net.Http.Json" Version="8.0.1" />
|
||||
<PackageReference Include="JsonConverter.System.Text.Json" Version="0.7.0" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
|
||||
@@ -113,9 +136,18 @@
|
||||
|
||||
<Protobuf Include="Grpc\greet.proto" GrpcServices="Client" />
|
||||
<Protobuf Include="Grpc\policy.proto" GrpcServices="Client" />
|
||||
</ItemGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<!--<PackageReference Include="System.Net.Http.Json" Version="8.0.1" />-->
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
|
||||
<!--<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
|
||||
<ProjectReference Include="..\..\src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj" />
|
||||
</ItemGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -133,26 +165,26 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Grpc\Test\greet.proto">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Grpc\request.proto">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<!--<GrpcServices>Client</GrpcServices>-->
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<!--<GrpcServices>Client</GrpcServices>-->
|
||||
</None>
|
||||
<None Update="Grpc\greet1.proto">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<!--<GrpcServices>Client</GrpcServices>-->
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<!--<GrpcServices>Client</GrpcServices>-->
|
||||
</None>
|
||||
<None Update="Grpc\policy.proto">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<GrpcServices>Client</GrpcServices>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<GrpcServices>Client</GrpcServices>
|
||||
</None>
|
||||
<None Update="Grpc\greet.proto">
|
||||
<GrpcServices>Client</GrpcServices>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Grpc\Test\SubFolder\request.proto">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Grpc\ot\opentelemetry\proto\**\*.proto">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !NET451 && !NET452
|
||||
|
||||
//#if !NET451 && !NET452
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
@@ -49,13 +48,10 @@ public partial class WireMockServerTests
|
||||
httpMessageHandler.ClientCertificates.AddRange(certificates);
|
||||
|
||||
// Act
|
||||
var response = await new HttpClient(httpMessageHandler)
|
||||
.GetAsync("https://localhost:" + server.Ports[0] + "/foo")
|
||||
.ConfigureAwait(false);
|
||||
var response = await new HttpClient(httpMessageHandler).GetAsync("https://localhost:" + server.Ports[0] + "/foo");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
@@ -7,6 +7,7 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if MIMEKIT
|
||||
//#if MIMEKIT
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
@@ -74,4 +74,4 @@ public partial class WireMockServerTests
|
||||
server.Stop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
@@ -102,7 +102,7 @@ public partial class WireMockServerTests
|
||||
|
||||
// then
|
||||
Check.That(server.Mappings).IsEmpty();
|
||||
Check.ThatAsyncCode(() => new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + path)).ThrowsAny();
|
||||
Check.ThatCode(() => new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + path)).ThrowsAny();
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user