Add support for Faults (#360)

* FaultType - wip

* .

* copy fault

* tests

* code-factor

* more tests

* fix tests

* fixed

* remove RANDOM_DATA_THEN_CLOSE
This commit is contained in:
Stef Heyenrath
2019-10-26 06:01:25 +00:00
committed by GitHub
parent fc024678fa
commit 596177d4e5
22 changed files with 311 additions and 23 deletions

View File

@@ -0,0 +1,18 @@
namespace WireMock.Admin.Mappings
{
/// <summary>
/// Fault Model
/// </summary>
public class FaultModel
{
/// <summary>
/// Gets or sets the fault. Can be null, "", NONE, EMPTY_RESPONSE, MALFORMED_RESPONSE_CHUNK or RANDOM_DATA_THEN_CLOSE.
/// </summary>
public string Type { get; set; }
/// <summary>
/// Gets or sets the fault percentage.
/// </summary>
public double? Percentage { get; set; }
}
}

View File

@@ -86,5 +86,10 @@ namespace WireMock.Admin.Mappings
/// The client X509Certificate2 Thumbprint or SubjectName to use.
/// </summary>
public string X509Certificate2ThumbprintOrSubjectName { get; set; }
/// <summary>
/// Gets or sets the fault.
/// </summary>
public FaultModel Fault { get; set; }
}
}

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using WireMock.Admin.Mappings;
using WireMock.ResponseBuilders;
using WireMock.Util;
namespace WireMock.Admin.Requests
@@ -68,5 +69,15 @@ namespace WireMock.Admin.Requests
/// The detected body type (detection based on Content-Type).
/// </summary>
public BodyType DetectedBodyTypeFromContentType { get; set; }
/// <summary>
/// The FaultType.
/// </summary>
public string FaultType { get; set; }
/// <summary>
/// Gets or sets the Fault percentage.
/// </summary>
public double? FaultPercentage { get; set; }
}
}