mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-21 08:21:53 +02:00
Add HandleBars Random functionality (#219)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using System.Threading.Tasks;
|
||||
using NFluent;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.ResponseBuilders
|
||||
{
|
||||
public class ResponseWithHandlebarsRandomTests
|
||||
{
|
||||
private const string ClientIp = "::1";
|
||||
|
||||
[Fact]
|
||||
public async Task Response_ProvideResponseAsync_Handlebars_Random()
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost:1234"), "GET", ClientIp);
|
||||
|
||||
var response = Response.Create()
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
Text = "{{Random Type=\"Text\" Min=8 Max=20}}",
|
||||
DateTime = "{{Random Type=\"DateTime\"}}",
|
||||
Guid = "{{Random Type=\"Guid\" Uppercase=true}}"
|
||||
})
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var responseMessage = await response.ProvideResponseAsync(request);
|
||||
|
||||
// assert
|
||||
Check.That(responseMessage.BodyData).IsNotNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user