Add Random Regex (using Fare) (#236)

* Xeger

* update example

* 1.0.7

* Fix tests for Handlebars_Xeger

* ReplaceNodeValue

* 1.0.5

* readme
This commit is contained in:
Stef Heyenrath
2018-12-06 14:29:12 +01:00
committed by GitHub
parent cd200a10a4
commit 4be1483a5f
10 changed files with 166 additions and 28 deletions

View File

@@ -34,9 +34,30 @@ namespace WireMock.Net.Tests.ResponseBuilders
// Assert
JObject j = JObject.FromObject(responseMessage.BodyData.BodyAsJson);
Check.That(j["Text"]).IsNotNull();
Check.That(j["Text"].Value<string>()).IsNotEmpty();
Check.That(j["Integer"].Value<int>()).IsEqualTo(1000);
Check.That(j["Long"].Value<int>()).IsStrictlyGreaterThan(77777777).And.IsStrictlyLessThan(99999999);
Check.That(j["Long"].Value<long>()).IsStrictlyGreaterThan(77777777).And.IsStrictlyLessThan(99999999);
}
[Fact]
public async Task Response_ProvideResponseAsync_Handlebars_Random1_Boolean()
{
// Assign
var request = new RequestMessage(new UrlDetails("http://localhost:1234"), "GET", ClientIp);
var response = Response.Create()
.WithBodyAsJson(new
{
Value = "{{Random Type=\"Boolean\"}}"
})
.WithTransformer();
// Act
var responseMessage = await response.ProvideResponseAsync(request);
// Assert
JObject j = JObject.FromObject(responseMessage.BodyData.BodyAsJson);
Check.That(j["Value"].Type).IsEqualTo(JTokenType.Boolean);
}
[Fact]