mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-11 03:06:48 +02:00
ICallbackResponseBuilder + added more unit-tests (#101)
* Callback * Add more tests
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using WireMock.Validation;
|
||||
|
||||
namespace WireMock.ResponseProviders
|
||||
{
|
||||
internal class DynamicResponseProvider : IResponseProvider
|
||||
{
|
||||
private readonly Func<RequestMessage, ResponseMessage> _responseMessageFunc;
|
||||
|
||||
public DynamicResponseProvider([NotNull] Func<RequestMessage, ResponseMessage> responseMessageFunc)
|
||||
{
|
||||
Check.NotNull(responseMessageFunc, nameof(responseMessageFunc));
|
||||
|
||||
_responseMessageFunc = responseMessageFunc;
|
||||
}
|
||||
|
||||
public Task<ResponseMessage> ProvideResponseAsync(RequestMessage requestMessage)
|
||||
{
|
||||
return Task.FromResult(_responseMessageFunc(requestMessage));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user