mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-24 18:11:10 +01:00
* netcore 2.1 * SimpleCommandLineParserTests * tests * SimpleCommandLineParserTests * test report * AspNetCoreSelfHost * Fixed Resharper warnings * tests * . * ResponseWithProxyTests ResponseWithProxyTests * postmanecho
26 lines
819 B
C#
26 lines
819 B
C#
using System.Threading.Tasks;
|
|
using NFluent;
|
|
using WireMock.Models;
|
|
using WireMock.ResponseBuilders;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.ResponseBuilders
|
|
{
|
|
public class ResponseWithCallbackTests
|
|
{
|
|
[Fact]
|
|
public async Task Response_WithCallback()
|
|
{
|
|
// Assign
|
|
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1");
|
|
var response = Response.Create().WithCallback(req => new ResponseMessage { Body = req.Path + "Bar", StatusCode = 302 });
|
|
|
|
// Act
|
|
var responseMessage = await response.ProvideResponseAsync(request);
|
|
|
|
// Assert
|
|
Check.That(responseMessage.Body).IsEqualTo("/fooBar");
|
|
Check.That(responseMessage.StatusCode).IsEqualTo(302);
|
|
}
|
|
}
|
|
} |