mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-18 07:00:04 +02:00
Add property 'IsStartedWithAdminInterface' to 'IWireMockServer' (#931)
* Add property 'IsStartedWithAdminInterface' to 'IWireMockServer' * update tests * .
This commit is contained in:
@@ -17,6 +17,11 @@ public interface IWireMockServer : IDisposable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsStarted { get; }
|
bool IsStarted { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this server is started with the admin interface enabled.
|
||||||
|
/// </summary>
|
||||||
|
bool IsStartedWithAdminInterface { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the request logs.
|
/// Gets the request logs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -43,10 +43,14 @@ public partial class WireMockServer : IWireMockServer
|
|||||||
private readonly IGuidUtils _guidUtils = new GuidUtils();
|
private readonly IGuidUtils _guidUtils = new GuidUtils();
|
||||||
private readonly IDateTimeUtils _dateTimeUtils = new DateTimeUtils();
|
private readonly IDateTimeUtils _dateTimeUtils = new DateTimeUtils();
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockServer.IsStarted" />
|
/// <inheritdoc />
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public bool IsStarted => _httpServer is { IsStarted: true };
|
public bool IsStarted => _httpServer is { IsStarted: true };
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
[PublicAPI]
|
||||||
|
public bool IsStartedWithAdminInterface => IsStarted && _settings.StartAdminInterface.GetValueOrDefault();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public List<int> Ports { get; }
|
public List<int> Ports { get; }
|
||||||
|
|||||||
@@ -34,6 +34,32 @@ public partial class WireMockServerTests
|
|||||||
_testOutputHelper = testOutputHelper;
|
_testOutputHelper = testOutputHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void WireMockServer_Start()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var server = WireMockServer.Start();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
server.IsStarted.Should().BeTrue();
|
||||||
|
server.IsStartedWithAdminInterface.Should().BeFalse();
|
||||||
|
|
||||||
|
server.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void WireMockServer_StartWithAdminInterface()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var server = WireMockServer.StartWithAdminInterface();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
server.IsStarted.Should().BeTrue();
|
||||||
|
server.IsStartedWithAdminInterface.Should().BeTrue();
|
||||||
|
|
||||||
|
server.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task WireMockServer_Should_Reset_LogEntries()
|
public async Task WireMockServer_Should_Reset_LogEntries()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user