Add Port and Url property to WireMockServer (#740)

This commit is contained in:
Stef Heyenrath
2022-03-26 11:03:37 +01:00
committed by GitHub
parent 0789b97883
commit cbf82836f5
10 changed files with 31 additions and 13 deletions

View File

@@ -38,11 +38,21 @@ namespace WireMock.Server
/// </summary>
List<int> Ports { get; }
/// <summary>
/// Gets the first port.
/// </summary>
int Port { get; }
/// <summary>
/// Gets the urls.
/// </summary>
string[] Urls { get; }
/// <summary>
/// Gets the first url.
/// </summary>
string Url { get; }
//ConcurrentDictionary<string, ScenarioState> Scenarios { get; }
/// <summary>

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Threading;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Stef.Validation;
using WireMock.Admin.Mappings;
using WireMock.Authentication;
using WireMock.Exceptions;
@@ -18,7 +19,6 @@ using WireMock.RequestBuilders;
using WireMock.ResponseProviders;
using WireMock.Serialization;
using WireMock.Settings;
using Stef.Validation;
namespace WireMock.Server
{
@@ -40,14 +40,22 @@ namespace WireMock.Server
[PublicAPI]
public bool IsStarted => _httpServer != null && _httpServer.IsStarted;
/// <inheritdoc cref="IWireMockServer.Ports" />
/// <inheritdoc />
[PublicAPI]
public List<int> Ports { get; }
/// <inheritdoc cref="IWireMockServer.Urls" />
/// <inheritdoc />
[PublicAPI]
public int Port => Ports?.FirstOrDefault() ?? default(int);
/// <inheritdoc />
[PublicAPI]
public string[] Urls { get; }
/// <inheritdoc />
[PublicAPI]
public string Url => Urls?.FirstOrDefault();
/// <summary>
/// Gets the mappings.
/// </summary>

View File

@@ -60,7 +60,7 @@
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
<PackageReference Include="Stef.Validation" Version="0.1.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.17" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.18" />
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.14" />
<PackageReference Include="JmesPath.Net" Version="1.0.125" />
<PackageReference Include="AnyOf" Version="0.3.0" />