Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WithBody when using Pact and added more nullable annotations #783

Merged
merged 13 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WireMock.Net Solution.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Victoor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Webhook/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Webhooks/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=wiremock/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=wiremockserver/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xunit/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
35 changes: 17 additions & 18 deletions src/WireMock.Net.Abstractions/Admin/Mappings/WebProxyModel.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
namespace WireMock.Admin.Mappings
namespace WireMock.Admin.Mappings;

/// <summary>
/// WebProxy settings
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class WebProxyModel
{
/// <summary>
/// WebProxy settings
/// A string instance that contains the address of the proxy server.
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class WebProxyModel
{
/// <summary>
/// A string instance that contains the address of the proxy server.
/// </summary>
public string Address { get; set; }
public string Address { get; set; } = null!;

/// <summary>
/// The user name associated with the credentials.
/// </summary>
public string UserName { get; set; }
/// <summary>
/// The user name associated with the credentials. [optional]
/// </summary>
public string? UserName { get; set; }

/// <summary>
/// The password for the user name associated with the credentials.
/// </summary>
public string Password { get; set; }
}
/// <summary>
/// The password for the user name associated with the credentials. [optional]
/// </summary>
public string? Password { get; set; }
}
92 changes: 45 additions & 47 deletions src/WireMock.Net.Abstractions/Admin/Mappings/WebhookRequestModel.cs
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
using System.Collections.Generic;
using WireMock.Types;

namespace WireMock.Admin.Mappings
namespace WireMock.Admin.Mappings;

/// <summary>
/// RequestModel
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class WebhookRequestModel
{
/// <summary>
/// RequestModel
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class WebhookRequestModel
{
/// <summary>
/// Gets or sets the Url.
/// </summary>
public string Url { get; set; }

/// <summary>
/// The method
/// </summary>
public string Method { get; set; }

/// <summary>
/// Gets or sets the headers.
/// </summary>
public IDictionary<string, string>? Headers { get; set; }

/// <summary>
/// Gets or sets the body.
/// </summary>
public string? Body { get; set; }

/// <summary>
/// Gets or sets the body (as JSON object).
/// </summary>
public object? BodyAsJson { get; set; }

/// <summary>
/// Use ResponseMessage Transformer.
/// </summary>
public bool? UseTransformer { get; set; }

/// <summary>
/// Gets the type of the transformer.
/// </summary>
public string TransformerType { get; set; }

/// <summary>
/// The ReplaceNodeOptions to use when transforming a JSON node.
/// </summary>
public string TransformerReplaceNodeOptions { get; set; }
}
/// Gets or sets the Url.
/// </summary>
public string Url { get; set; }

/// <summary>
/// The method
/// </summary>
public string Method { get; set; }

/// <summary>
/// Gets or sets the headers.
/// </summary>
public IDictionary<string, string>? Headers { get; set; }

/// <summary>
/// Gets or sets the body.
/// </summary>
public string? Body { get; set; }

/// <summary>
/// Gets or sets the body (as JSON object).
/// </summary>
public object? BodyAsJson { get; set; }

/// <summary>
/// Use ResponseMessage Transformer.
/// </summary>
public bool? UseTransformer { get; set; }

/// <summary>
/// Gets the type of the transformer.
/// </summary>
public string? TransformerType { get; set; }

/// <summary>
/// The ReplaceNodeOptions to use when transforming a JSON node.
/// </summary>
public string? TransformerReplaceNodeOptions { get; set; }
}
4 changes: 2 additions & 2 deletions src/WireMock.Net.Abstractions/IRequestMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public interface IRequestMessage
/// <summary>
/// Gets the headers.
/// </summary>
IDictionary<string, WireMockList<string>> Headers { get; }
IDictionary<string, WireMockList<string>>? Headers { get; }

/// <summary>
/// Gets the cookies.
/// </summary>
IDictionary<string, string> Cookies { get; }
IDictionary<string, string>? Cookies { get; }

/// <summary>
/// Gets the query.
Expand Down
107 changes: 53 additions & 54 deletions src/WireMock.Net.Abstractions/IResponseMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,59 @@
using WireMock.Types;
using WireMock.Util;

namespace WireMock
namespace WireMock;

/// <summary>
/// IResponseMessage
/// </summary>
public interface IResponseMessage
{
/// <summary>
/// IResponseMessage
/// </summary>
public interface IResponseMessage
{
/// <summary>
/// The Body.
/// </summary>
IBodyData? BodyData { get; }

/// <summary>
/// Gets the body destination (SameAsSource, String or Bytes).
/// </summary>
string BodyDestination { get; }

/// <summary>
/// Gets or sets the body.
/// </summary>
string BodyOriginal { get; }

/// <summary>
/// Gets the Fault percentage.
/// </summary>
double? FaultPercentage { get; }

/// <summary>
/// The FaultType.
/// </summary>
FaultType FaultType { get; }

/// <summary>
/// Gets the headers.
/// </summary>
IDictionary<string, WireMockList<string>>? Headers { get; }

/// <summary>
/// Gets or sets the status code.
/// </summary>
object StatusCode { get; }

/// <summary>
/// Adds the header.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
void AddHeader(string name, string value);

/// <summary>
/// Adds the header.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="values">The values.</param>
void AddHeader(string name, params string[] values);
}
/// The Body.
/// </summary>
IBodyData? BodyData { get; }

/// <summary>
/// Gets the body destination (Null, SameAsSource, String or Bytes).
/// </summary>
string? BodyDestination { get; }

/// <summary>
/// Gets or sets the body.
/// </summary>
string? BodyOriginal { get; }

/// <summary>
/// Gets the Fault percentage.
/// </summary>
double? FaultPercentage { get; }

/// <summary>
/// The FaultType.
/// </summary>
FaultType FaultType { get; }

/// <summary>
/// Gets the headers.
/// </summary>
IDictionary<string, WireMockList<string>>? Headers { get; }

/// <summary>
/// Gets or sets the status code.
/// </summary>
object? StatusCode { get; }

/// <summary>
/// Adds the header.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
void AddHeader(string name, string value);

/// <summary>
/// Adds the header.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="values">The values.</param>
void AddHeader(string name, params string[] values);
}
101 changes: 50 additions & 51 deletions src/WireMock.Net.Abstractions/Logging/ILogEntry.cs
Original file line number Diff line number Diff line change
@@ -1,56 +1,55 @@
using System;
using System;
using WireMock.Matchers.Request;

namespace WireMock.Logging
namespace WireMock.Logging;

/// <summary>
/// ILogEntry
/// </summary>
public interface ILogEntry
{
/// <summary>
/// ILogEntry
/// </summary>
public interface ILogEntry
{
/// <summary>
/// Gets the unique identifier.
/// </summary>
Guid Guid { get; }

/// <summary>
/// Gets the mapping unique identifier.
/// </summary>
Guid? MappingGuid { get; }

/// <summary>
/// Gets the mapping unique title.
/// </summary>
string MappingTitle { get; }

/// <summary>
/// Gets the partial mapping unique identifier.
/// </summary>
Guid? PartialMappingGuid { get; }

/// <summary>
/// Gets the partial mapping unique title.
/// </summary>
string PartialMappingTitle { get; }

/// <summary>
/// Gets the partial match result.
/// </summary>
IRequestMatchResult PartialMatchResult { get; }

/// <summary>
/// Gets the request match result.
/// </summary>
IRequestMatchResult RequestMatchResult { get; }

/// <summary>
/// Gets the request message.
/// </summary>
IRequestMessage RequestMessage { get; }

/// <summary>
/// Gets the response message.
/// </summary>
IResponseMessage ResponseMessage { get; }
}
/// Gets the unique identifier.
/// </summary>
Guid Guid { get; }

/// <summary>
/// Gets the mapping unique identifier.
/// </summary>
Guid? MappingGuid { get; }

/// <summary>
/// Gets the mapping unique title.
/// </summary>
string? MappingTitle { get; }

/// <summary>
/// Gets the partial mapping unique identifier.
/// </summary>
Guid? PartialMappingGuid { get; }

/// <summary>
/// Gets the partial mapping unique title.
/// </summary>
string? PartialMappingTitle { get; }

/// <summary>
/// Gets the partial match result.
/// </summary>
IRequestMatchResult PartialMatchResult { get; }

/// <summary>
/// Gets the request match result.
/// </summary>
IRequestMatchResult RequestMatchResult { get; }

/// <summary>
/// Gets the request message.
/// </summary>
IRequestMessage RequestMessage { get; }

/// <summary>
/// Gets the response message.
/// </summary>
IResponseMessage ResponseMessage { get; }
}
Loading