// Copyright © WireMock.Net
using System;
using JetBrains.Annotations;
using Stef.Validation;
using WireMock.Matchers.Request;
using WireMock.RequestBuilders;
namespace WireMock.Server;
public partial class WireMockServer
{
///
/// Given
///
/// The request matcher.
/// Optional boolean to indicate if this mapping should be saved as static mapping file.
/// The .
[PublicAPI]
public IRespondWithAProvider Given(IRequestMatcher requestMatcher, bool saveToFile = false)
{
return _mappingBuilder.Given(requestMatcher, saveToFile);
}
///
/// WhenRequest
///
/// The action to use the fluent .
/// Optional boolean to indicate if this mapping should be saved as static mapping file.
/// The .
[PublicAPI]
public IRespondWithAProvider WhenRequest(Action action, bool saveToFile = false)
{
Guard.NotNull(action);
var requestBuilder = Request.Create();
action(requestBuilder);
return Given(requestBuilder, saveToFile);
}
}