mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-14 06:17:11 +01: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>
|
||||
bool IsStarted { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this server is started with the admin interface enabled.
|
||||
/// </summary>
|
||||
bool IsStartedWithAdminInterface { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the request logs.
|
||||
/// </summary>
|
||||
|
||||
@@ -43,10 +43,14 @@ public partial class WireMockServer : IWireMockServer
|
||||
private readonly IGuidUtils _guidUtils = new GuidUtils();
|
||||
private readonly IDateTimeUtils _dateTimeUtils = new DateTimeUtils();
|
||||
|
||||
/// <inheritdoc cref="IWireMockServer.IsStarted" />
|
||||
/// <inheritdoc />
|
||||
[PublicAPI]
|
||||
public bool IsStarted => _httpServer is { IsStarted: true };
|
||||
|
||||
/// <inheritdoc />
|
||||
[PublicAPI]
|
||||
public bool IsStartedWithAdminInterface => IsStarted && _settings.StartAdminInterface.GetValueOrDefault();
|
||||
|
||||
/// <inheritdoc />
|
||||
[PublicAPI]
|
||||
public List<int> Ports { get; }
|
||||
|
||||
@@ -34,6 +34,32 @@ public partial class WireMockServerTests
|
||||
_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]
|
||||
public async Task WireMockServer_Should_Reset_LogEntries()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user