diff --git a/src/MockHttp.Json/Extensions/MockHttpRequestContextExtensions.cs b/src/MockHttp.Json/Extensions/MockHttpRequestContextExtensions.cs
index d4be3f7b..d6b8f7a5 100644
--- a/src/MockHttp.Json/Extensions/MockHttpRequestContextExtensions.cs
+++ b/src/MockHttp.Json/Extensions/MockHttpRequestContextExtensions.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
// ReSharper disable once CheckNamespace : BREAKING - change namespace with next release. (remove Extensions)
namespace MockHttp.Json.Extensions;
diff --git a/src/MockHttp.Json/Extensions/ResponseBuilderExtensions.cs b/src/MockHttp.Json/Extensions/ResponseBuilderExtensions.cs
index 0d1bc38a..7f7970f4 100644
--- a/src/MockHttp.Json/Extensions/ResponseBuilderExtensions.cs
+++ b/src/MockHttp.Json/Extensions/ResponseBuilderExtensions.cs
@@ -4,7 +4,7 @@
using MockHttp.Json.Extensions;
using MockHttp.Language.Flow.Response;
using MockHttp.Language.Response;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Json;
@@ -71,7 +71,12 @@ internal JsonContentBehavior
_adapter = adapter;
}
- public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken)
+ public Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
IJsonAdapter jsonSerializerAdapter = _adapter ?? requestContext.GetAdapter();
object? value = _jsonContentFactory();
@@ -84,7 +89,7 @@ public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessa
}
};
- return next(requestContext, responseMessage, cancellationToken);
+ return nextHandler(requestContext, responseMessage, cancellationToken);
}
}
}
diff --git a/src/MockHttp.Json/JsonContentMatcher.cs b/src/MockHttp.Json/JsonContentMatcher.cs
index 5450fb18..714bd375 100644
--- a/src/MockHttp.Json/JsonContentMatcher.cs
+++ b/src/MockHttp.Json/JsonContentMatcher.cs
@@ -1,7 +1,7 @@
using MockHttp.Json.Extensions;
using MockHttp.Json.SystemTextJson;
using MockHttp.Matchers;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Json;
diff --git a/src/MockHttp.Server/MockHttpServer.cs b/src/MockHttp.Server/MockHttpServer.cs
index 81d2fc02..c2659424 100644
--- a/src/MockHttp.Server/MockHttpServer.cs
+++ b/src/MockHttp.Server/MockHttpServer.cs
@@ -32,18 +32,8 @@ public sealed class MockHttpServer
private IWebHost? _host;
///
- /// Initializes a new instance of the using specified and configures it to listen on specified .
- ///
- /// The mock http handler.
- /// The host URL the mock HTTP server will listen on.
- [Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttpHandler mockHttpHandler, string hostUrl)
- : this(mockHttpHandler, GetHostUrl(hostUrl))
- {
- }
-
- ///
- /// Initializes a new instance of the using specified and configures it to listen on specified .
+ /// Initializes a new instance of the using specified and configures it to
+ /// listen on specified .
///
/// The mock http handler.
/// The host URI the mock HTTP server will listen on.
@@ -53,25 +43,19 @@ public MockHttpServer(MockHttpHandler mockHttpHandler, Uri hostUri)
}
///
- /// Initializes a new instance of the using specified and configures it to listen on specified .
- ///
- /// The mock http handler.
- /// The logger factory to use to log pipeline requests to.
- /// The host URL the mock HTTP server will listen on.
- [Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttpHandler mockHttpHandler, ILoggerFactory? loggerFactory, string hostUrl)
- : this(mockHttpHandler, loggerFactory, GetHostUrl(hostUrl))
- {
- }
-
- ///
- /// Initializes a new instance of the using specified and configures it to listen on specified .
+ /// Initializes a new instance of the using specified and configures it to
+ /// listen on specified .
///
/// The mock http handler.
/// The logger factory to use to log pipeline requests to.
/// The host URI the mock HTTP server will listen on.
public MockHttpServer(MockHttpHandler mockHttpHandler, ILoggerFactory? loggerFactory, Uri hostUri)
{
+ if (hostUri is null)
+ {
+ throw new ArgumentNullException(nameof(hostUri));
+ }
+
Handler = mockHttpHandler ?? throw new ArgumentNullException(nameof(mockHttpHandler));
_webHostBuilder = CreateWebHostBuilder(loggerFactory);
_hostUri = new Uri(hostUri, "/"); // Ensure base URL.
@@ -102,14 +86,6 @@ public async ValueTask DisposeAsync()
///
public MockHttpHandler Handler { get; }
- ///
- /// Gets the host URL the mock HTTP server will listen on.
- ///
- [Obsolete("Use the HostUri instead.")]
-#pragma warning disable CA1056 // URI-like properties should not be strings
- public string HostUrl => HostUri.ToString().TrimEnd('/');
-#pragma warning restore CA1056 // URI-like properties should not be strings
-
///
/// Gets the host URI the mock HTTP server will listen on.
///
@@ -237,18 +213,6 @@ internal void Configure(Action configureAppBuilder)
_configureAppBuilder = configureAppBuilder;
}
- private static Uri GetHostUrl(string hostUrl)
- {
- if (hostUrl is null)
- {
- throw new ArgumentNullException(nameof(hostUrl));
- }
-
- return Uri.TryCreate(hostUrl, UriKind.Absolute, out Uri? uri)
- ? uri
- : throw new ArgumentException(Resources.Error_HostUrlIsNotValid, nameof(hostUrl));
- }
-
private void AddMockHttpServerHeader(IApplicationBuilder applicationBuilder)
{
applicationBuilder.Use(async (context, next) =>
diff --git a/src/MockHttp.Server/Resources.Designer.cs b/src/MockHttp.Server/Resources.Designer.cs
index f0f46d20..eab82ed5 100644
--- a/src/MockHttp.Server/Resources.Designer.cs
+++ b/src/MockHttp.Server/Resources.Designer.cs
@@ -78,15 +78,6 @@ internal static string Debug_RequestHandled {
}
}
- ///
- /// Looks up a localized string similar to Specify a host URL..
- ///
- internal static string Error_HostUrlIsNotValid {
- get {
- return ResourceManager.GetString("Error_HostUrlIsNotValid", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to MockHttpServer failed to handle request. Please verify your mock setup is correct..
///
diff --git a/src/MockHttp.Server/Resources.resx b/src/MockHttp.Server/Resources.resx
index e9716da8..ff404fd8 100644
--- a/src/MockHttp.Server/Resources.resx
+++ b/src/MockHttp.Server/Resources.resx
@@ -129,9 +129,6 @@
MockHttpServer received request.
-
- Specify a host URL.
-
HTTP response feature missing.
diff --git a/src/MockHttp/Extensions/IRespondsExtensions.cs b/src/MockHttp/Extensions/IRespondsExtensions.cs
index dd2ec52b..df6d35a0 100644
--- a/src/MockHttp/Extensions/IRespondsExtensions.cs
+++ b/src/MockHttp/Extensions/IRespondsExtensions.cs
@@ -2,7 +2,6 @@
using MockHttp.Language.Flow;
using MockHttp.Language.Flow.Response;
using MockHttp.Response;
-using MockHttp.Responses;
namespace MockHttp;
diff --git a/src/MockHttp/IInvokedHttpRequestCollection.cs b/src/MockHttp/IInvokedHttpRequestCollection.cs
index 94d90063..72f82500 100644
--- a/src/MockHttp/IInvokedHttpRequestCollection.cs
+++ b/src/MockHttp/IInvokedHttpRequestCollection.cs
@@ -1,11 +1,9 @@
-using MockHttp.Threading;
-
-namespace MockHttp;
+namespace MockHttp;
///
/// Represents a collection of invoked HTTP requests.
///
-public interface IInvokedHttpRequestCollection : IConcurrentReadOnlyCollection
+public interface IInvokedHttpRequestCollection : IReadOnlyList
{
///
/// Clears the invoked requests collection.
diff --git a/src/MockHttp/Internal/Extensions/HttpRequestMatcherExtensions.cs b/src/MockHttp/Internal/Extensions/HttpRequestMatcherExtensions.cs
index 399752c5..b67e1df1 100644
--- a/src/MockHttp/Internal/Extensions/HttpRequestMatcherExtensions.cs
+++ b/src/MockHttp/Internal/Extensions/HttpRequestMatcherExtensions.cs
@@ -1,5 +1,5 @@
using MockHttp.Matchers;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Extensions;
diff --git a/src/MockHttp/Internal/HttpCall.cs b/src/MockHttp/Internal/HttpCall.cs
index bbce3cbe..4c603028 100644
--- a/src/MockHttp/Internal/HttpCall.cs
+++ b/src/MockHttp/Internal/HttpCall.cs
@@ -1,7 +1,7 @@
using System.Collections.ObjectModel;
using System.Text;
using MockHttp.Matchers;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp;
diff --git a/src/MockHttp/Internal/HttpCallSequence.cs b/src/MockHttp/Internal/HttpCallSequence.cs
index d5002485..9a203977 100644
--- a/src/MockHttp/Internal/HttpCallSequence.cs
+++ b/src/MockHttp/Internal/HttpCallSequence.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp;
diff --git a/src/MockHttp/Internal/Response/Behaviors/HttpContentBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/HttpContentBehavior.cs
index e701590d..3da32b84 100644
--- a/src/MockHttp/Internal/Response/Behaviors/HttpContentBehavior.cs
+++ b/src/MockHttp/Internal/Response/Behaviors/HttpContentBehavior.cs
@@ -1,6 +1,4 @@
-using MockHttp.Responses;
-
-namespace MockHttp.Response.Behaviors;
+namespace MockHttp.Response.Behaviors;
internal sealed class HttpContentBehavior
: IResponseBehavior
@@ -12,9 +10,14 @@ public HttpContentBehavior(Func> httpConten
_httpContentFactory = httpContentFactory ?? throw new ArgumentNullException(nameof(httpContentFactory));
}
- public async Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken)
+ public async Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
responseMessage.Content = await _httpContentFactory(cancellationToken).ConfigureAwait(false);
- await next(requestContext, responseMessage, cancellationToken).ConfigureAwait(false);
+ await nextHandler(requestContext, responseMessage, cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/MockHttp/Internal/Response/Behaviors/HttpHeaderBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/HttpHeaderBehavior.cs
index 314e9bf0..cb33596a 100644
--- a/src/MockHttp/Internal/Response/Behaviors/HttpHeaderBehavior.cs
+++ b/src/MockHttp/Internal/Response/Behaviors/HttpHeaderBehavior.cs
@@ -1,5 +1,4 @@
using MockHttp.Http;
-using MockHttp.Responses;
namespace MockHttp.Response.Behaviors;
@@ -37,7 +36,12 @@ public HttpHeaderBehavior(IEnumerable>
_headers = headers?.ToList() ?? throw new ArgumentNullException(nameof(headers));
}
- public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken)
+ public Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
// ReSharper disable once UseDeconstruction
foreach (KeyValuePair> header in _headers)
@@ -45,7 +49,7 @@ public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessa
Add(header, responseMessage);
}
- return next(requestContext, responseMessage, cancellationToken);
+ return nextHandler(requestContext, responseMessage, cancellationToken);
}
///
diff --git a/src/MockHttp/Internal/Response/Behaviors/NetworkLatencyBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/NetworkLatencyBehavior.cs
index 18eeeb71..8a382f5e 100644
--- a/src/MockHttp/Internal/Response/Behaviors/NetworkLatencyBehavior.cs
+++ b/src/MockHttp/Internal/Response/Behaviors/NetworkLatencyBehavior.cs
@@ -1,6 +1,4 @@
-using MockHttp.Responses;
-
-namespace MockHttp.Response.Behaviors;
+namespace MockHttp.Response.Behaviors;
internal sealed class NetworkLatencyBehavior
: IResponseBehavior
@@ -12,8 +10,13 @@ public NetworkLatencyBehavior(NetworkLatency networkLatency)
_networkLatency = networkLatency ?? throw new ArgumentNullException(nameof(networkLatency));
}
- public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken)
+ public Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
- return _networkLatency.SimulateAsync(() => next(requestContext, responseMessage, cancellationToken), cancellationToken);
+ return _networkLatency.SimulateAsync(() => nextHandler(requestContext, responseMessage, cancellationToken), cancellationToken);
}
}
diff --git a/src/MockHttp/Internal/Response/Behaviors/StatusCodeBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/StatusCodeBehavior.cs
index a9a3c9c0..04c02d95 100644
--- a/src/MockHttp/Internal/Response/Behaviors/StatusCodeBehavior.cs
+++ b/src/MockHttp/Internal/Response/Behaviors/StatusCodeBehavior.cs
@@ -1,5 +1,4 @@
using System.Net;
-using MockHttp.Responses;
namespace MockHttp.Response.Behaviors;
@@ -20,7 +19,12 @@ public StatusCodeBehavior(HttpStatusCode statusCode, string? reasonPhrase)
_reasonPhrase = reasonPhrase;
}
- public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken)
+ public Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
responseMessage.StatusCode = _statusCode;
if (_reasonPhrase is not null)
@@ -28,6 +32,6 @@ public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessa
responseMessage.ReasonPhrase = _reasonPhrase;
}
- return next(requestContext, responseMessage, cancellationToken);
+ return nextHandler(requestContext, responseMessage, cancellationToken);
}
}
diff --git a/src/MockHttp/Internal/Response/Behaviors/TimeoutBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/TimeoutBehavior.cs
index ea934661..83fed725 100644
--- a/src/MockHttp/Internal/Response/Behaviors/TimeoutBehavior.cs
+++ b/src/MockHttp/Internal/Response/Behaviors/TimeoutBehavior.cs
@@ -1,5 +1,4 @@
using System.Runtime.InteropServices;
-using MockHttp.Responses;
using MockHttp.Threading;
namespace MockHttp.Response.Behaviors;
@@ -19,7 +18,12 @@ public TimeoutBehavior(TimeSpan timeoutAfter)
_timeoutAfter = timeoutAfter;
}
- public Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken)
+ public Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
// It is somewhat unintuitive to throw TaskCanceledException but this is what HttpClient does,
// so we simulate same behavior.
diff --git a/src/MockHttp/Internal/Response/Behaviors/TransferRateBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/TransferRateBehavior.cs
index cd6d830f..b821534e 100644
--- a/src/MockHttp/Internal/Response/Behaviors/TransferRateBehavior.cs
+++ b/src/MockHttp/Internal/Response/Behaviors/TransferRateBehavior.cs
@@ -1,6 +1,5 @@
using System.Net;
using MockHttp.IO;
-using MockHttp.Responses;
namespace MockHttp.Response.Behaviors;
@@ -18,9 +17,14 @@ public TransferRateBehavior(int bitRate)
_bitRate = bitRate;
}
- public async Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken)
+ public async Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
- await next(requestContext, responseMessage, cancellationToken).ConfigureAwait(false);
+ await nextHandler(requestContext, responseMessage, cancellationToken).ConfigureAwait(false);
responseMessage.Content = new RateLimitedHttpContent(responseMessage.Content, _bitRate);
}
diff --git a/src/MockHttp/Internal/Response/ExceptionStrategy.cs b/src/MockHttp/Internal/Response/ExceptionStrategy.cs
index 41e1a66f..a4e9c795 100644
--- a/src/MockHttp/Internal/Response/ExceptionStrategy.cs
+++ b/src/MockHttp/Internal/Response/ExceptionStrategy.cs
@@ -1,6 +1,4 @@
-using MockHttp.Responses;
-
-namespace MockHttp.Response;
+namespace MockHttp.Response;
internal sealed class ExceptionStrategy : IResponseStrategy
{
diff --git a/src/MockHttp/Internal/Response/ResponseFuncStrategy.cs b/src/MockHttp/Internal/Response/ResponseFuncStrategy.cs
index 07bf1418..3d07c3bd 100644
--- a/src/MockHttp/Internal/Response/ResponseFuncStrategy.cs
+++ b/src/MockHttp/Internal/Response/ResponseFuncStrategy.cs
@@ -1,6 +1,4 @@
-using MockHttp.Responses;
-
-namespace MockHttp.Response;
+namespace MockHttp.Response;
internal sealed class ResponseFuncStrategy : IResponseStrategy
{
diff --git a/src/MockHttp/Internal/Threading/ConcurrentCollection.cs b/src/MockHttp/Internal/Threading/ConcurrentCollection.cs
index 1534b5ba..65edbafd 100644
--- a/src/MockHttp/Internal/Threading/ConcurrentCollection.cs
+++ b/src/MockHttp/Internal/Threading/ConcurrentCollection.cs
@@ -3,7 +3,7 @@
namespace MockHttp.Threading;
-internal class ConcurrentCollection : IConcurrentReadOnlyCollection
+internal class ConcurrentCollection : IReadOnlyList
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly object _syncLock = new();
diff --git a/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs b/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs
index bd3e6bf6..402d8c51 100644
--- a/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs
+++ b/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs
@@ -1,20 +1,20 @@
using MockHttp.Http;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Language.Flow.Response;
internal sealed class EnsureHttpContentBehavior
: IResponseBehavior
{
- public Task HandleAsync
- (
+ public Task HandleAsync(
MockHttpRequestContext requestContext,
HttpResponseMessage responseMessage,
- ResponseHandlerDelegate next,
- CancellationToken cancellationToken)
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ )
{
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
responseMessage.Content ??= new EmptyContent();
- return next(requestContext, responseMessage, cancellationToken);
+ return nextHandler(requestContext, responseMessage, cancellationToken);
}
}
diff --git a/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs b/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs
index d38e27db..183a75a9 100644
--- a/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs
+++ b/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs
@@ -3,8 +3,8 @@
using System.Net.Http.Headers;
using MockHttp.Extensions;
using MockHttp.Http;
+using MockHttp.Response;
using MockHttp.Response.Behaviors;
-using MockHttp.Responses;
namespace MockHttp.Language.Flow.Response;
@@ -96,8 +96,14 @@ static Task Seed(MockHttpRequestContext requestContext, HttpResponseMessage resp
};
await _invertedBehaviors
- .Aggregate((ResponseHandlerDelegate)Seed,
- (next, pipeline) => (context, message, ct) => pipeline.HandleAsync(context, message, next, ct)
+ .Aggregate(
+ (ResponseHandler)Seed,
+ (next, pipeline) => (context, message, ct) => pipeline.HandleAsync(
+ context,
+ message,
+ next,
+ ct
+ )
)(requestContext, response, cancellationToken)
.ConfigureAwait(false);
diff --git a/src/MockHttp/Language/Flow/SetupPhrase.cs b/src/MockHttp/Language/Flow/SetupPhrase.cs
index dce15751..ba8b966e 100644
--- a/src/MockHttp/Language/Flow/SetupPhrase.cs
+++ b/src/MockHttp/Language/Flow/SetupPhrase.cs
@@ -1,6 +1,5 @@
using System.ComponentModel;
using MockHttp.Response;
-using MockHttp.Responses;
namespace MockHttp.Language.Flow;
diff --git a/src/MockHttp/Language/IResponds.cs b/src/MockHttp/Language/IResponds.cs
index 0bc5a4fb..04e414ae 100644
--- a/src/MockHttp/Language/IResponds.cs
+++ b/src/MockHttp/Language/IResponds.cs
@@ -1,6 +1,6 @@
using System.ComponentModel;
using MockHttp.Language.Flow;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Language;
diff --git a/src/MockHttp/Language/Response/IWithResponse.cs b/src/MockHttp/Language/Response/IWithResponse.cs
index 50b487f5..9370b988 100644
--- a/src/MockHttp/Language/Response/IWithResponse.cs
+++ b/src/MockHttp/Language/Response/IWithResponse.cs
@@ -1,5 +1,5 @@
using System.ComponentModel;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Language.Response;
diff --git a/src/MockHttp/Matchers/AnyMatcher.cs b/src/MockHttp/Matchers/AnyMatcher.cs
index 5018af87..092b874b 100644
--- a/src/MockHttp/Matchers/AnyMatcher.cs
+++ b/src/MockHttp/Matchers/AnyMatcher.cs
@@ -1,13 +1,13 @@
using System.Text;
using MockHttp.Extensions;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by verifying it against a list of constraints, for which at least one has to match the request.
///
-public class AnyMatcher : IAsyncHttpRequestMatcher
+internal sealed class AnyMatcher : IAsyncHttpRequestMatcher
{
///
/// Initializes a new instance of the class using specified list of .
diff --git a/src/MockHttp/Matchers/ContentMatcher.cs b/src/MockHttp/Matchers/ContentMatcher.cs
index e42e576e..9b895f2a 100644
--- a/src/MockHttp/Matchers/ContentMatcher.cs
+++ b/src/MockHttp/Matchers/ContentMatcher.cs
@@ -1,14 +1,14 @@
using System.Diagnostics;
using System.Globalization;
using System.Text;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by the request content.
///
-public class ContentMatcher : IAsyncHttpRequestMatcher
+internal class ContentMatcher : IAsyncHttpRequestMatcher
{
private const int MaxBytesDisplayed = 10;
diff --git a/src/MockHttp/Matchers/ExpressionMatcher.cs b/src/MockHttp/Matchers/ExpressionMatcher.cs
index da354ad2..06b7bc3a 100644
--- a/src/MockHttp/Matchers/ExpressionMatcher.cs
+++ b/src/MockHttp/Matchers/ExpressionMatcher.cs
@@ -1,12 +1,12 @@
using System.Linq.Expressions;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request using a custom expression.
///
-public class ExpressionMatcher : HttpRequestMatcher
+internal sealed class ExpressionMatcher : HttpRequestMatcher
{
private readonly string _funcDisplay;
private readonly Func _func;
diff --git a/src/MockHttp/Matchers/FormDataMatcher.cs b/src/MockHttp/Matchers/FormDataMatcher.cs
index e8044072..e54a494d 100644
--- a/src/MockHttp/Matchers/FormDataMatcher.cs
+++ b/src/MockHttp/Matchers/FormDataMatcher.cs
@@ -1,13 +1,13 @@
using System.Diagnostics;
using MockHttp.Http;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by the posted form data.
///
-public class FormDataMatcher : IAsyncHttpRequestMatcher
+internal sealed class FormDataMatcher : IAsyncHttpRequestMatcher
{
internal const string MultipartFormDataMediaType = "multipart/form-data";
@@ -43,7 +43,7 @@ public FormDataMatcher(string urlEncodedFormData)
}
///
- public virtual Task IsMatchAsync(MockHttpRequestContext requestContext)
+ public Task IsMatchAsync(MockHttpRequestContext requestContext)
{
if (requestContext is null)
{
@@ -85,7 +85,7 @@ private static bool HasOneOf(IEnumerable left, IEnumerable right
}
///
- public virtual bool IsExclusive => _matchQs.Count == 0;
+ public bool IsExclusive => _matchQs.Count == 0;
///
public override string ToString()
diff --git a/src/MockHttp/Matchers/HttpHeadersMatcher.cs b/src/MockHttp/Matchers/HttpHeadersMatcher.cs
index 918abfc9..a2fdbe12 100644
--- a/src/MockHttp/Matchers/HttpHeadersMatcher.cs
+++ b/src/MockHttp/Matchers/HttpHeadersMatcher.cs
@@ -1,14 +1,14 @@
using System.Net.Http.Headers;
using MockHttp.Http;
using MockHttp.Patterns;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by the request headers.
///
-public class HttpHeadersMatcher : ValueMatcher
+internal sealed class HttpHeadersMatcher : ValueMatcher
{
private readonly HttpHeaderEqualityComparer _equalityComparer;
diff --git a/src/MockHttp/Matchers/HttpMethodMatcher.cs b/src/MockHttp/Matchers/HttpMethodMatcher.cs
index a12bd167..cf2b9662 100644
--- a/src/MockHttp/Matchers/HttpMethodMatcher.cs
+++ b/src/MockHttp/Matchers/HttpMethodMatcher.cs
@@ -1,11 +1,11 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by HTTP method.
///
-public class HttpMethodMatcher : ValueMatcher
+internal sealed class HttpMethodMatcher : ValueMatcher
{
///
/// Initializes a new instance of the class using specified .
diff --git a/src/MockHttp/Matchers/HttpRequestMatcher.cs b/src/MockHttp/Matchers/HttpRequestMatcher.cs
index 2dc753d8..1e3532cd 100644
--- a/src/MockHttp/Matchers/HttpRequestMatcher.cs
+++ b/src/MockHttp/Matchers/HttpRequestMatcher.cs
@@ -1,11 +1,11 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Represents a condition for matching a .
///
-public abstract class HttpRequestMatcher : IAsyncHttpRequestMatcher
+internal abstract class HttpRequestMatcher : IAsyncHttpRequestMatcher
{
///
/// Initializes a new instance of the class.
diff --git a/src/MockHttp/Matchers/IAsyncHttpRequestMatcher.cs b/src/MockHttp/Matchers/IAsyncHttpRequestMatcher.cs
index fa1d2a3e..d4d6f3f0 100644
--- a/src/MockHttp/Matchers/IAsyncHttpRequestMatcher.cs
+++ b/src/MockHttp/Matchers/IAsyncHttpRequestMatcher.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/src/MockHttp/Matchers/MediaTypeHeaderMatcher.cs b/src/MockHttp/Matchers/MediaTypeHeaderMatcher.cs
index 8f3ca0f9..4e9dc540 100644
--- a/src/MockHttp/Matchers/MediaTypeHeaderMatcher.cs
+++ b/src/MockHttp/Matchers/MediaTypeHeaderMatcher.cs
@@ -1,12 +1,12 @@
using System.Net.Http.Headers;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by the media type header.
///
-public class MediaTypeHeaderMatcher : ValueMatcher
+internal sealed class MediaTypeHeaderMatcher : ValueMatcher
{
///
/// Initializes a new instance of the class.
diff --git a/src/MockHttp/Matchers/NotMatcher.cs b/src/MockHttp/Matchers/NotMatcher.cs
index 246d78ed..3674b191 100644
--- a/src/MockHttp/Matchers/NotMatcher.cs
+++ b/src/MockHttp/Matchers/NotMatcher.cs
@@ -1,11 +1,11 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matcher that inverts the final result of matching a set of inner matchers.
///
-internal class NotMatcher : IAsyncHttpRequestMatcher
+internal sealed class NotMatcher : IAsyncHttpRequestMatcher
{
private readonly IAsyncHttpRequestMatcher _matcher;
diff --git a/src/MockHttp/Matchers/PartialContentMatcher.cs b/src/MockHttp/Matchers/PartialContentMatcher.cs
index 9604c01b..e5b991aa 100644
--- a/src/MockHttp/Matchers/PartialContentMatcher.cs
+++ b/src/MockHttp/Matchers/PartialContentMatcher.cs
@@ -6,7 +6,7 @@ namespace MockHttp.Matchers;
///
/// Matches a request by partially matching the request content.
///
-public class PartialContentMatcher : ContentMatcher
+internal sealed class PartialContentMatcher : ContentMatcher
{
///
/// Initializes a new instance of the class using specified .
diff --git a/src/MockHttp/Matchers/QueryStringMatcher.cs b/src/MockHttp/Matchers/QueryStringMatcher.cs
index 8b9a6b24..8bf3482d 100644
--- a/src/MockHttp/Matchers/QueryStringMatcher.cs
+++ b/src/MockHttp/Matchers/QueryStringMatcher.cs
@@ -1,13 +1,13 @@
using System.Diagnostics;
using MockHttp.Http;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by the request URI query string.
///
-public class QueryStringMatcher : HttpRequestMatcher
+internal sealed class QueryStringMatcher : HttpRequestMatcher
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly QueryString _matchQs;
diff --git a/src/MockHttp/Matchers/RequestUriMatcher.cs b/src/MockHttp/Matchers/RequestUriMatcher.cs
deleted file mode 100644
index 38510a71..00000000
--- a/src/MockHttp/Matchers/RequestUriMatcher.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using System.Diagnostics;
-using MockHttp.Http;
-using MockHttp.Patterns;
-using MockHttp.Responses;
-using static MockHttp.Http.UriExtensions;
-
-namespace MockHttp.Matchers;
-
-///
-/// Matches a request by the request URI.
-///
-[Obsolete($"Replaced with {nameof(UriMatcher)}. Will be removed in next major release.")]
-public class RequestUriMatcher : HttpRequestMatcher
-{
- [DebuggerBrowsable(DebuggerBrowsableState.Never)]
- private readonly Uri _requestUri = default!;
- [DebuggerBrowsable(DebuggerBrowsableState.Never)]
- private readonly string _formattedUri;
- [DebuggerBrowsable(DebuggerBrowsableState.Never)]
- private readonly WildcardPattern? _uriPatternMatcher;
-
- ///
- /// Initializes a new instance of the class using specified .
- ///
- /// The request URI.
- public RequestUriMatcher(Uri uri)
- {
- _requestUri = uri.EnsureIsRooted();
- _formattedUri = _requestUri.ToString();
- }
-
- ///
- /// Initializes a new instance of the class using specified .
- ///
- /// The request URI or a URI wildcard.
- /// to allow wildcards, or if exact matching.
- public RequestUriMatcher(string uriString, bool allowWildcards = true)
- {
- _formattedUri = uriString ?? throw new ArgumentNullException(nameof(uriString));
-
- if (allowWildcards
-#if NETSTANDARD2_0 || NETFRAMEWORK
- && uriString.Contains("*")
-#else
- && uriString.Contains('*', StringComparison.InvariantCultureIgnoreCase)
-#endif
- )
- {
- _uriPatternMatcher = WildcardPattern.Create(uriString);
- }
- else
- {
- // If no wildcards, then must be actual uri.
- _requestUri = new Uri(uriString, DotNetRelativeOrAbsolute).EnsureIsRooted();
- _formattedUri = _requestUri.ToString();
- }
- }
-
- ///
- public override bool IsMatch(MockHttpRequestContext requestContext)
- {
- if (requestContext is null)
- {
- throw new ArgumentNullException(nameof(requestContext));
- }
-
- Uri? requestUri = requestContext.Request.RequestUri;
- if (requestUri is null)
- {
- return false;
- }
-
- if (_uriPatternMatcher is null)
- {
- return IsAbsoluteUriMatch(requestUri) || IsRelativeUriMatch(requestUri);
- }
-
- return _uriPatternMatcher.Value.IsMatch(requestUri.ToString());
- }
-
- private bool IsAbsoluteUriMatch(Uri uri)
- {
- return _requestUri.IsAbsoluteUri && uri.Equals(_requestUri);
- }
-
- private bool IsRelativeUriMatch(Uri uri)
- {
- return !_requestUri.IsAbsoluteUri
- && uri.IsBaseOf(_requestUri)
- && uri.ToString().EndsWith(_requestUri.ToString(), StringComparison.Ordinal);
- }
-
- ///
- public override string ToString()
- {
- return $"RequestUri: '{_formattedUri}'";
- }
-}
diff --git a/src/MockHttp/Matchers/UriMatcher.cs b/src/MockHttp/Matchers/UriMatcher.cs
index 4716672d..d621bcf1 100644
--- a/src/MockHttp/Matchers/UriMatcher.cs
+++ b/src/MockHttp/Matchers/UriMatcher.cs
@@ -1,14 +1,14 @@
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using MockHttp.Patterns;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by the URI.
///
-internal class UriMatcher : HttpRequestMatcher
+internal sealed class UriMatcher : HttpRequestMatcher
{
private readonly string _name;
private readonly Pattern _pattern;
diff --git a/src/MockHttp/Matchers/ValueMatcher.cs b/src/MockHttp/Matchers/ValueMatcher.cs
index 4fded867..c513fc55 100644
--- a/src/MockHttp/Matchers/ValueMatcher.cs
+++ b/src/MockHttp/Matchers/ValueMatcher.cs
@@ -4,7 +4,7 @@
/// Base class that matches a request by a value.
///
/// The type of the value to match.
-public abstract class ValueMatcher : HttpRequestMatcher
+internal abstract class ValueMatcher : HttpRequestMatcher
{
///
/// Initializes a new instance of the class using specified .
diff --git a/src/MockHttp/Matchers/VersionMatcher.cs b/src/MockHttp/Matchers/VersionMatcher.cs
index 9fa76018..7e4f5cbd 100644
--- a/src/MockHttp/Matchers/VersionMatcher.cs
+++ b/src/MockHttp/Matchers/VersionMatcher.cs
@@ -1,11 +1,11 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
///
/// Matches a request by the HTTP message version.
///
-public class VersionMatcher : ValueMatcher
+internal sealed class VersionMatcher : ValueMatcher
{
///
/// Initializes a new instance of the class using specified .
diff --git a/src/MockHttp/MockHttpHandler.cs b/src/MockHttp/MockHttpHandler.cs
index 9c4a64ac..8ff19e3f 100644
--- a/src/MockHttp/MockHttpHandler.cs
+++ b/src/MockHttp/MockHttpHandler.cs
@@ -5,7 +5,7 @@
using MockHttp.Language;
using MockHttp.Language.Flow;
using MockHttp.Matchers;
-using MockHttp.Responses;
+using MockHttp.Response;
using MockHttp.Threading;
namespace MockHttp;
diff --git a/src/MockHttp/Properties/InternalsVisibleTo.cs b/src/MockHttp/Properties/InternalsVisibleTo.cs
index 9dccda5d..9097bd3d 100644
--- a/src/MockHttp/Properties/InternalsVisibleTo.cs
+++ b/src/MockHttp/Properties/InternalsVisibleTo.cs
@@ -1,4 +1,5 @@
using System.Runtime.CompilerServices;
+[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
[assembly: InternalsVisibleTo("MockHttp.Tests")]
[assembly: InternalsVisibleTo("MockHttp.Testing")]
diff --git a/src/MockHttp/Response/IResponseBehavior.cs b/src/MockHttp/Response/IResponseBehavior.cs
new file mode 100644
index 00000000..13c749b6
--- /dev/null
+++ b/src/MockHttp/Response/IResponseBehavior.cs
@@ -0,0 +1,33 @@
+namespace MockHttp.Response;
+
+///
+/// A delegate which when executed returns a configured HTTP response.
+///
+///
+public delegate Task ResponseHandler(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ CancellationToken cancellationToken
+);
+
+///
+/// Describes a way to apply a response behavior in a response builder pipeline.
+///
+public interface IResponseBehavior
+{
+ ///
+ /// Executes the behavior. Call to execute the next behavior in the response pipeline and use its returned
+ /// response message.
+ ///
+ /// The current request context.
+ /// The response message.
+ /// The next handler.
+ /// The cancellation token.
+ /// An awaitable that upon completion returns the HTTP response message.
+ Task HandleAsync(
+ MockHttpRequestContext requestContext,
+ HttpResponseMessage responseMessage,
+ ResponseHandler nextHandler,
+ CancellationToken cancellationToken
+ );
+}
diff --git a/src/MockHttp/Responses/IResponseStrategy.cs b/src/MockHttp/Response/IResponseStrategy.cs
similarity index 94%
rename from src/MockHttp/Responses/IResponseStrategy.cs
rename to src/MockHttp/Response/IResponseStrategy.cs
index 54f502a5..97decbe5 100644
--- a/src/MockHttp/Responses/IResponseStrategy.cs
+++ b/src/MockHttp/Response/IResponseStrategy.cs
@@ -1,4 +1,4 @@
-namespace MockHttp.Responses;
+namespace MockHttp.Response;
///
/// Represents a strategy that produces a mocked response.
diff --git a/src/MockHttp/Responses/MockHttpRequestContext.cs b/src/MockHttp/Response/MockHttpRequestContext.cs
similarity index 98%
rename from src/MockHttp/Responses/MockHttpRequestContext.cs
rename to src/MockHttp/Response/MockHttpRequestContext.cs
index 6e6f586e..8c7530da 100644
--- a/src/MockHttp/Responses/MockHttpRequestContext.cs
+++ b/src/MockHttp/Response/MockHttpRequestContext.cs
@@ -1,7 +1,7 @@
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
-namespace MockHttp.Responses;
+namespace MockHttp.Response;
///
/// Represents the mocked request context.
diff --git a/src/MockHttp/Responses/IResponseBehavior.cs b/src/MockHttp/Responses/IResponseBehavior.cs
deleted file mode 100644
index 8b18be31..00000000
--- a/src/MockHttp/Responses/IResponseBehavior.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace MockHttp.Responses;
-
-///
-/// A delegate which when executed returns a configured HTTP response.
-///
-///
-public delegate Task ResponseHandlerDelegate(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, CancellationToken cancellationToken);
-
-///
-/// Describes a way to apply a response behavior in a response builder pipeline.
-///
-public interface IResponseBehavior
-{
- ///
- /// Executes the behavior. Call to execute the next behavior in the response pipeline and use its returned response message.
- ///
- /// The current request context.
- /// The response message.
- /// The next behavior.
- /// The cancellation token.
- /// An awaitable that upon completion returns the HTTP response message.
- Task HandleAsync(MockHttpRequestContext requestContext, HttpResponseMessage responseMessage, ResponseHandlerDelegate next, CancellationToken cancellationToken);
-}
diff --git a/src/MockHttp/Threading/IConcurrentReadOnlyCollection.cs b/src/MockHttp/Threading/IConcurrentReadOnlyCollection.cs
deleted file mode 100644
index 75ad3d60..00000000
--- a/src/MockHttp/Threading/IConcurrentReadOnlyCollection.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace MockHttp.Threading;
-
-///
-/// Represents a thread safe read-only collection of elements that can be accessed by index.
-///
-// vNext(breaking: remove obsolete by implementing IReadOnlyList on IInvokedHttpRequestCollection.
-[Obsolete("Will be removed in next version.")]
-public interface IConcurrentReadOnlyCollection : IReadOnlyList
-{
-}
diff --git a/test/MockHttp.Json.Tests/Extensions/MockHttpRequestContextExtensionsTests.cs b/test/MockHttp.Json.Tests/Extensions/MockHttpRequestContextExtensionsTests.cs
index 8d1f0f01..1a48ae8b 100644
--- a/test/MockHttp.Json.Tests/Extensions/MockHttpRequestContextExtensionsTests.cs
+++ b/test/MockHttp.Json.Tests/Extensions/MockHttpRequestContextExtensionsTests.cs
@@ -1,5 +1,5 @@
using MockHttp.Json.SystemTextJson;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Json.Extensions;
diff --git a/test/MockHttp.Json.Tests/JsonContentMatcherTests.cs b/test/MockHttp.Json.Tests/JsonContentMatcherTests.cs
index 25fb1c7f..75a157a1 100644
--- a/test/MockHttp.Json.Tests/JsonContentMatcherTests.cs
+++ b/test/MockHttp.Json.Tests/JsonContentMatcherTests.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Json;
diff --git a/test/MockHttp.Server.Tests/MockHttpServerTests.cs b/test/MockHttp.Server.Tests/MockHttpServerTests.cs
index 77538956..2d155c6f 100644
--- a/test/MockHttp.Server.Tests/MockHttpServerTests.cs
+++ b/test/MockHttp.Server.Tests/MockHttpServerTests.cs
@@ -169,7 +169,7 @@ public async Task When_using_other_API_like_webRequest_it_should_respond_correct
// Act
#pragma warning disable CS0618
#pragma warning disable SYSLIB0014 // Type or member is obsolete - justification: testing other API's
- var request = WebRequest.Create($"{_fixture.Server.HostUrl}/web-request");
+ var request = WebRequest.Create($"{_fixture.Server.HostUri}web-request");
#pragma warning restore SYSLIB0014 // Type or member is obsolete
#pragma warning restore CS0618
request.Method = "POST";
@@ -177,7 +177,7 @@ public async Task When_using_other_API_like_webRequest_it_should_respond_correct
request.ContentType = MediaTypes.PlainText;
await using (Stream requestStream = await request.GetRequestStreamAsync())
{
- requestStream.Write(Encoding.ASCII.GetBytes("request-content"));
+ await requestStream.WriteAsync(Encoding.ASCII.GetBytes("request-content"));
}
// Assert
@@ -286,50 +286,31 @@ public async Task When_creating_and_starting_server_with_null_logger_it_should_n
}
[Fact]
- [Obsolete("Removed in next major version.")]
public void When_creating_server_with_null_host_it_should_throw()
{
- string? hostUrl = null;
+ Uri? hostUri = null;
// Act
-#pragma warning disable CS8604
- Func act = () => new MockHttpServer(new MockHttpHandler(), hostUrl);
-#pragma warning restore CS8604
+ Func act = () => new MockHttpServer(new MockHttpHandler(), hostUri!);
// Assert
- act.Should().Throw().WithParameterName(nameof(hostUrl));
+ act.Should().Throw().WithParameterName(nameof(hostUri));
}
[Fact]
- [Obsolete("Removed in next major version.")]
- public void When_creating_server_with_invalid_host_it_should_throw()
- {
- const string hostUrl = "relative/uri/is/invalid";
-
- // Act
- // ReSharper disable once ExpressionIsAlwaysNull
- Func act = () => new MockHttpServer(new MockHttpHandler(), hostUrl);
-
- // Assert
- act.Should().Throw().WithParameterName(nameof(hostUrl));
- }
-
- [Fact]
- [Obsolete("Removed in next major version.")]
public async Task When_creating_server_with_absolute_uri_it_should_not_throw_and_take_host_from_url()
{
- var hostUrl = new Uri("https://relative:789/uri/is/invalid");
+ var hostUri = new Uri("https://relative:789/uri/is/invalid");
const string expectedHostUrl = "https://relative:789";
// Act
- // ReSharper disable once ExpressionIsAlwaysNull
- Func act = () => new MockHttpServer(new MockHttpHandler(), hostUrl);
+ Func act = () => new MockHttpServer(new MockHttpHandler(), hostUri);
// Assert
MockHttpServer server = act.Should().NotThrow().Which;
await using (server)
{
- act.Should().NotThrow().Which.HostUrl.Should().Be(expectedHostUrl);
+ act.Should().NotThrow().Which.HostUri.Should().Be(expectedHostUrl);
}
}
diff --git a/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt b/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt
index 940f517d..143aa9ce 100644
--- a/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt
+++ b/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt
@@ -5,16 +5,10 @@ namespace MockHttp
{
public sealed class MockHttpServer : System.IAsyncDisposable, System.IDisposable
{
- [System.Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, string hostUrl) { }
public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, System.Uri hostUri) { }
- [System.Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory, string hostUrl) { }
public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory, System.Uri hostUri) { }
public MockHttp.MockHttpHandler Handler { get; }
public System.Uri HostUri { get; }
- [System.Obsolete("Use the HostUri instead.")]
- public string HostUrl { get; }
public bool IsStarted { get; }
public System.Net.Http.HttpClient CreateClient() { }
public void Dispose() { }
diff --git a/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt b/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt
index 20731476..d8533301 100644
--- a/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt
+++ b/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt
@@ -5,16 +5,10 @@ namespace MockHttp
{
public sealed class MockHttpServer : System.IAsyncDisposable, System.IDisposable
{
- [System.Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, string hostUrl) { }
public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, System.Uri hostUri) { }
- [System.Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory, string hostUrl) { }
public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory, System.Uri hostUri) { }
public MockHttp.MockHttpHandler Handler { get; }
public System.Uri HostUri { get; }
- [System.Obsolete("Use the HostUri instead.")]
- public string HostUrl { get; }
public bool IsStarted { get; }
public System.Net.Http.HttpClient CreateClient() { }
public void Dispose() { }
diff --git a/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_Core_3.1.verified.txt b/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_Core_3.1.verified.txt
index 41f0a258..22117bcc 100644
--- a/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_Core_3.1.verified.txt
+++ b/test/MockHttp.Server.Tests/PublicApiTests.Api_has_not_changed.NET_Core_3.1.verified.txt
@@ -5,16 +5,10 @@ namespace MockHttp
{
public sealed class MockHttpServer : System.IAsyncDisposable, System.IDisposable
{
- [System.Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, string hostUrl) { }
public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, System.Uri hostUri) { }
- [System.Obsolete("Use the overload accepting an System.Uri.")]
- public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory, string hostUrl) { }
public MockHttpServer(MockHttp.MockHttpHandler mockHttpHandler, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory, System.Uri hostUri) { }
public MockHttp.MockHttpHandler Handler { get; }
public System.Uri HostUri { get; }
- [System.Obsolete("Use the HostUri instead.")]
- public string HostUrl { get; }
public bool IsStarted { get; }
public System.Net.Http.HttpClient CreateClient() { }
public void Dispose() { }
diff --git a/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs b/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs
index 12c51bc2..35f9868b 100644
--- a/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs
+++ b/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs
@@ -3,7 +3,7 @@
using MockHttp.FluentAssertions;
using MockHttp.Language;
using MockHttp.Language.Flow;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp;
diff --git a/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs b/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs
index 62c679bb..dfc03f79 100644
--- a/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs
+++ b/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs
@@ -6,7 +6,7 @@
using MockHttp.Extensions;
using MockHttp.Http;
using MockHttp.Matchers;
-using MockHttp.Responses;
+using MockHttp.Response;
using static MockHttp.Http.UriExtensions;
namespace MockHttp;
diff --git a/test/MockHttp.Tests/Internal/HttpCallTests.cs b/test/MockHttp.Tests/Internal/HttpCallTests.cs
index 0717bfe5..eff109fa 100644
--- a/test/MockHttp.Tests/Internal/HttpCallTests.cs
+++ b/test/MockHttp.Tests/Internal/HttpCallTests.cs
@@ -1,5 +1,4 @@
using MockHttp.Response;
-using MockHttp.Responses;
namespace MockHttp;
diff --git a/test/MockHttp.Tests/Internal/Response/Behaviors/TimeoutBehaviorTests.cs b/test/MockHttp.Tests/Internal/Response/Behaviors/TimeoutBehaviorTests.cs
index 0f88e407..a98ec6dc 100644
--- a/test/MockHttp.Tests/Internal/Response/Behaviors/TimeoutBehaviorTests.cs
+++ b/test/MockHttp.Tests/Internal/Response/Behaviors/TimeoutBehaviorTests.cs
@@ -1,5 +1,4 @@
using System.Diagnostics;
-using MockHttp.Responses;
namespace MockHttp.Response.Behaviors;
@@ -16,7 +15,7 @@ public async Task Given_that_timeout_is_not_zero_when_sending_it_should_timeout_
var timeout = TimeSpan.FromMilliseconds(timeoutInMilliseconds);
var sut = new TimeoutBehavior(timeout);
var sw = new Stopwatch();
- ResponseHandlerDelegate nextStub = Substitute.For();
+ ResponseHandler nextStub = Substitute.For();
// Act
Func act = () => sut.HandleAsync(new MockHttpRequestContext(new HttpRequestMessage()), new HttpResponseMessage(), nextStub, CancellationToken.None);
@@ -40,7 +39,7 @@ public async Task Given_that_cancellation_token_is_cancelled_when_sending_it_sho
var timeout = TimeSpan.FromSeconds(60);
var sut = new TimeoutBehavior(timeout);
var ct = new CancellationToken(true);
- ResponseHandlerDelegate nextStub = Substitute.For();
+ ResponseHandler nextStub = Substitute.For();
// Act
var sw = Stopwatch.StartNew();
diff --git a/test/MockHttp.Tests/Internal/Response/ExceptionStrategyTests.cs b/test/MockHttp.Tests/Internal/Response/ExceptionStrategyTests.cs
index 15026db4..9bfd1a03 100644
--- a/test/MockHttp.Tests/Internal/Response/ExceptionStrategyTests.cs
+++ b/test/MockHttp.Tests/Internal/Response/ExceptionStrategyTests.cs
@@ -1,6 +1,4 @@
-using MockHttp.Responses;
-
-namespace MockHttp.Response;
+namespace MockHttp.Response;
public class ExceptionStrategyTests
{
diff --git a/test/MockHttp.Tests/Internal/Response/ResponseFuncStrategyTests.cs b/test/MockHttp.Tests/Internal/Response/ResponseFuncStrategyTests.cs
index 5e51aff6..4a7e1581 100644
--- a/test/MockHttp.Tests/Internal/Response/ResponseFuncStrategyTests.cs
+++ b/test/MockHttp.Tests/Internal/Response/ResponseFuncStrategyTests.cs
@@ -1,6 +1,4 @@
-using MockHttp.Responses;
-
-namespace MockHttp.Response;
+namespace MockHttp.Response;
public class ResponseFuncStrategyTests
{
diff --git a/test/MockHttp.Tests/Matchers/AnyMatcherTests.cs b/test/MockHttp.Tests/Matchers/AnyMatcherTests.cs
index 2615588b..56ed0cbb 100644
--- a/test/MockHttp.Tests/Matchers/AnyMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/AnyMatcherTests.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/BoolMatcher.cs b/test/MockHttp.Tests/Matchers/BoolMatcher.cs
index 7ff182da..4b57c5dc 100644
--- a/test/MockHttp.Tests/Matchers/BoolMatcher.cs
+++ b/test/MockHttp.Tests/Matchers/BoolMatcher.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/ContentMatcherTests.cs b/test/MockHttp.Tests/Matchers/ContentMatcherTests.cs
index 1e16afb6..74ed129a 100644
--- a/test/MockHttp.Tests/Matchers/ContentMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/ContentMatcherTests.cs
@@ -1,5 +1,5 @@
using System.Text;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/ExpressionMatcherTests.cs b/test/MockHttp.Tests/Matchers/ExpressionMatcherTests.cs
index b497e0d2..5aef2b28 100644
--- a/test/MockHttp.Tests/Matchers/ExpressionMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/ExpressionMatcherTests.cs
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/FakeToStringTestMatcher.cs b/test/MockHttp.Tests/Matchers/FakeToStringTestMatcher.cs
index 0a4660e5..e994b461 100644
--- a/test/MockHttp.Tests/Matchers/FakeToStringTestMatcher.cs
+++ b/test/MockHttp.Tests/Matchers/FakeToStringTestMatcher.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/FormDataMatcherTests.cs b/test/MockHttp.Tests/Matchers/FormDataMatcherTests.cs
index 8844b36b..a88a4651 100644
--- a/test/MockHttp.Tests/Matchers/FormDataMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/FormDataMatcherTests.cs
@@ -1,7 +1,7 @@
using System.Net.Http.Headers;
using System.Text;
using MockHttp.Http;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/HttpHeadersMatcherTests.cs b/test/MockHttp.Tests/Matchers/HttpHeadersMatcherTests.cs
index a2dd4688..608bce4b 100644
--- a/test/MockHttp.Tests/Matchers/HttpHeadersMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/HttpHeadersMatcherTests.cs
@@ -1,7 +1,7 @@
using System.Globalization;
using System.Net.Http.Headers;
using MockHttp.Http;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/HttpMethodMatcherTests.cs b/test/MockHttp.Tests/Matchers/HttpMethodMatcherTests.cs
index e1fdcb8d..3f7ef798 100644
--- a/test/MockHttp.Tests/Matchers/HttpMethodMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/HttpMethodMatcherTests.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/HttpRequestMatcherTests.cs b/test/MockHttp.Tests/Matchers/HttpRequestMatcherTests.cs
index d464ddd1..08609907 100644
--- a/test/MockHttp.Tests/Matchers/HttpRequestMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/HttpRequestMatcherTests.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/MediaTypeHeaderMatcherTests.cs b/test/MockHttp.Tests/Matchers/MediaTypeHeaderMatcherTests.cs
index 0d0f66d3..dd5d8409 100644
--- a/test/MockHttp.Tests/Matchers/MediaTypeHeaderMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/MediaTypeHeaderMatcherTests.cs
@@ -1,6 +1,6 @@
using System.Net.Http.Headers;
using MockHttp.Http;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/NotMatcherTests.cs b/test/MockHttp.Tests/Matchers/NotMatcherTests.cs
index 342130f7..9cf2fa9d 100644
--- a/test/MockHttp.Tests/Matchers/NotMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/NotMatcherTests.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/PartialContentMatcherTests.cs b/test/MockHttp.Tests/Matchers/PartialContentMatcherTests.cs
index f743a7b8..23bf38a5 100644
--- a/test/MockHttp.Tests/Matchers/PartialContentMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/PartialContentMatcherTests.cs
@@ -1,5 +1,5 @@
using System.Text;
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/QueryStringMatcherTests.cs b/test/MockHttp.Tests/Matchers/QueryStringMatcherTests.cs
index 2cdc6a1a..9e8fd917 100644
--- a/test/MockHttp.Tests/Matchers/QueryStringMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/QueryStringMatcherTests.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs b/test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs
deleted file mode 100644
index 10fc86df..00000000
--- a/test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-using MockHttp.Responses;
-
-namespace MockHttp.Matchers;
-
-[Obsolete($"Replaced with {nameof(UriMatcher)}. Will be removed in next major release.")]
-public class RequestUriMatcherTests
-{
- [Theory]
- [InlineData("", UriKind.Relative, "http://127.0.0.1/", true)]
- [InlineData("relative.htm", UriKind.Relative, "http://127.0.0.1/relative.htm", true)]
- [InlineData("/folder/relative.htm", UriKind.Relative, "http://127.0.0.1/relative.htm", false)]
- [InlineData("relative.htm", UriKind.Relative, "http://127.0.0.1/folder/relative.htm", false)]
- [InlineData("folder/relative.htm", UriKind.Relative, "http://127.0.0.1/folder/relative.htm", true)]
- [InlineData("/folder/relative.htm", UriKind.Relative, "http://127.0.0.1/folder/relative.htm", true)]
- [InlineData("http://127.0.0.1/absolute.htm", UriKind.Absolute, "http://127.0.0.1/absolute.htm", true)]
- [InlineData("http://127.0.0.1/absolute.htm", UriKind.Absolute, "http://127.0.0.1/folder/absolute.htm", false)]
- public void Given_uri_when_matching_should_match(string matchUri, UriKind uriKind, string requestUri, bool isMatch)
- {
- var request = new HttpRequestMessage { RequestUri = new Uri(requestUri, UriKind.Absolute) };
- var sut = new RequestUriMatcher(new Uri(matchUri, uriKind));
-
- // Act & assert
- sut.IsMatch(new MockHttpRequestContext(request)).Should().Be(isMatch);
- }
-
- [Theory]
- [InlineData("relative.htm", true, "http://127.0.0.1/relative.htm", true)]
- [InlineData("/folder/relative.htm", true, "http://127.0.0.1/relative.htm", false)]
- [InlineData("relative.htm", true, "http://127.0.0.1/folder/relative.htm", false)]
- [InlineData("folder/relative.htm", true, "http://127.0.0.1/folder/relative.htm", true)]
- [InlineData("/folder/relative.htm", true, "http://127.0.0.1/folder/relative.htm", true)]
- [InlineData("http://127.0.0.1/absolute.htm", true, "http://127.0.0.1/absolute.htm", true)]
- [InlineData("http://127.0.0.1/absolute.htm", true, "http://127.0.0.1/folder/absolute.htm", false)]
- [InlineData("*.htm", true, "http://127.0.0.1/relative.htm", true)]
- [InlineData("*/relative.htm", true, "http://127.0.0.1/relative.htm", true)]
- [InlineData("/*/relative.htm", true, "http://127.0.0.1/folder/relative.htm", false)]
- [InlineData("/*/relative.htm", true, "http://127.0.0.1/relative.htm", false)]
- [InlineData("/folder/*.htm", true, "http://127.0.0.1/folder/relative.htm", false)]
- [InlineData("*/folder/*.htm", true, "http://127.0.0.1/folder/relative.htm", true)]
- [InlineData("/folder/*.htm", true, "http://127.0.0.1/relative.htm", false)]
- [InlineData("/*/*/relative.*", true, "http://127.0.0.1/folder1/folder2/relative.htm", false)]
- [InlineData("*/folder1/*/relative.*", true, "http://127.0.0.1/folder1/folder2/relative.htm", true)]
- [InlineData("/*/*/relative.*", true, "http://127.0.0.1/folder1/relative.htm", false)]
- [InlineData("http://127.0.0.1/*.htm", true, "http://127.0.0.1/absolute.htm", true)]
- [InlineData("http://127.0.0.1/*.htm", true, "http://127.0.0.1/folder/absolute.htm", true)]
- public void Given_uriString_when_matching_should_match(string uriString, bool hasWildcard, string requestUri, bool isMatch)
- {
- var request = new HttpRequestMessage { RequestUri = new Uri(requestUri, UriKind.Absolute) };
- var sut = new RequestUriMatcher(uriString, hasWildcard);
-
- // Act & assert
- sut.IsMatch(new MockHttpRequestContext(request)).Should().Be(isMatch);
- }
-
- [Fact]
- public void Given_null_uri_when_creating_matcher_should_throw()
- {
- Uri? uri = null;
-
- // Act
- Func act = () => new RequestUriMatcher(uri!);
-
- // Assert
- act.Should()
- .Throw()
- .WithParameterName(nameof(uri));
- }
-
- [Fact]
- public void Given_null_uriString_when_creating_matcher_should_throw()
- {
- string? uriString = null;
-
- // Act
- Func act = () => new RequestUriMatcher(uriString!, false);
-
- // Assert
- act.Should()
- .Throw()
- .WithParameterName(nameof(uriString));
- }
-
- [Fact]
- public void When_formatting_should_return_human_readable_representation()
- {
- const string expectedText = "RequestUri: '*/controller/*'";
- var sut = new RequestUriMatcher("*/controller/*");
-
- // Act
- string displayText = sut.ToString();
-
- // Assert
- displayText.Should().Be(expectedText);
- }
-
- [Fact]
- public void Given_null_context_when_matching_it_should_throw()
- {
- var sut = new RequestUriMatcher("*/controller/*");
- MockHttpRequestContext? requestContext = null;
-
- // Act
- Action act = () => sut.IsMatch(requestContext!);
-
- // Assert
- act.Should()
- .Throw()
- .WithParameterName(nameof(requestContext));
- }
-}
diff --git a/test/MockHttp.Tests/Matchers/VersionMatcherTests.cs b/test/MockHttp.Tests/Matchers/VersionMatcherTests.cs
index dc3c94b6..aaee48fa 100644
--- a/test/MockHttp.Tests/Matchers/VersionMatcherTests.cs
+++ b/test/MockHttp.Tests/Matchers/VersionMatcherTests.cs
@@ -1,4 +1,4 @@
-using MockHttp.Responses;
+using MockHttp.Response;
namespace MockHttp.Matchers;
diff --git a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt
index 7b3e0ad1..8408ea9a 100644
--- a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt
+++ b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_6.0.verified.txt
@@ -40,7 +40,7 @@ namespace MockHttp
System.Collections.Generic.IReadOnlyCollection Matchers { get; }
System.Net.Http.HttpRequestMessage Request { get; }
}
- public interface IInvokedHttpRequestCollection : MockHttp.Threading.IConcurrentReadOnlyCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
+ public interface IInvokedHttpRequestCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
{
void Clear();
}
@@ -53,9 +53,9 @@ namespace MockHttp
{
public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
public static TResult Respond(this MockHttp.Language.IResponds responds, System.Func response)
where TResult : MockHttp.Language.Flow.IResponseResult { }
@@ -331,7 +331,7 @@ namespace MockHttp.Language
public interface IResponds : MockHttp.IFluentInterface
where out TResult : MockHttp.Language.Flow.IResponseResult
{
- TResult RespondUsing(MockHttp.Responses.IResponseStrategy responseStrategy);
+ TResult RespondUsing(MockHttp.Response.IResponseStrategy responseStrategy);
}
public interface IThrows : MockHttp.IFluentInterface
where out TResult : MockHttp.Language.Flow.IThrowsResult
@@ -362,7 +362,7 @@ namespace MockHttp.Language.Response
}
public interface IWithResponse : MockHttp.IFluentInterface
{
- System.Collections.Generic.IList Behaviors { get; }
+ System.Collections.Generic.IList Behaviors { get; }
}
public interface IWithStatusCode : MockHttp.IFluentInterface, MockHttp.Language.Response.IWithContent, MockHttp.Language.Response.IWithResponse
{
@@ -371,123 +371,21 @@ namespace MockHttp.Language.Response
}
namespace MockHttp.Matchers
{
- public class AnyMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public AnyMatcher(System.Collections.Generic.IReadOnlyCollection matchers) { }
- public bool IsExclusive { get; }
- public System.Collections.Generic.IReadOnlyCollection Matchers { get; }
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class ContentMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public ContentMatcher() { }
- public ContentMatcher(byte[] content) { }
- public ContentMatcher(string content, System.Text.Encoding? encoding) { }
- protected System.Collections.Generic.IReadOnlyList ByteContent { get; }
- public virtual bool IsExclusive { get; }
- protected virtual bool IsMatch(byte[] requestContent) { }
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class ExpressionMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public ExpressionMatcher(System.Linq.Expressions.Expression> expression) { }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class FormDataMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public FormDataMatcher(System.Collections.Generic.IEnumerable>> formData) { }
- public FormDataMatcher(string urlEncodedFormData) { }
- public virtual bool IsExclusive { get; }
- public virtual System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class HttpHeadersMatcher : MockHttp.Matchers.ValueMatcher
- {
- public HttpHeadersMatcher(System.Collections.Generic.IEnumerable>> headers) { }
- public HttpHeadersMatcher(System.Collections.Generic.IEnumerable> headers) { }
- public HttpHeadersMatcher(string name) { }
- public HttpHeadersMatcher(string name, System.Collections.Generic.IEnumerable values) { }
- public HttpHeadersMatcher(string name, string value, bool allowWildcards = false) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class HttpMethodMatcher : MockHttp.Matchers.ValueMatcher
- {
- public HttpMethodMatcher(System.Net.Http.HttpMethod method) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public abstract class HttpRequestMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- protected HttpRequestMatcher() { }
- public virtual bool IsExclusive { get; }
- public abstract bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext);
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public abstract override string ToString() { }
- }
public interface IAsyncHttpRequestMatcher
{
bool IsExclusive { get; }
- System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext);
- }
- public class MediaTypeHeaderMatcher : MockHttp.Matchers.ValueMatcher
- {
- public MediaTypeHeaderMatcher(System.Net.Http.Headers.MediaTypeHeaderValue headerValue) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class PartialContentMatcher : MockHttp.Matchers.ContentMatcher
- {
- public PartialContentMatcher(byte[] content) { }
- public PartialContentMatcher(string content, System.Text.Encoding? encoding) { }
- public override bool IsExclusive { get; }
- protected override bool IsMatch(byte[] requestContent) { }
- public override string ToString() { }
- }
- public class QueryStringMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public QueryStringMatcher(System.Collections.Generic.IEnumerable>> parameters) { }
- public QueryStringMatcher(string queryString) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- [System.Obsolete("Replaced with UriMatcher. Will be removed in next major release.")]
- public class RequestUriMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public RequestUriMatcher(System.Uri uri) { }
- public RequestUriMatcher(string uriString, bool allowWildcards = true) { }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public abstract class ValueMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- protected ValueMatcher(T value) { }
- protected T Value { get; }
- }
- public class VersionMatcher : MockHttp.Matchers.ValueMatcher
- {
- public VersionMatcher(System.Version version) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
+ System.Threading.Tasks.Task IsMatchAsync(MockHttp.Response.MockHttpRequestContext requestContext);
}
}
-namespace MockHttp.Responses
+namespace MockHttp.Response
{
public interface IResponseBehavior
{
- System.Threading.Tasks.Task HandleAsync(MockHttp.Responses.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, MockHttp.Responses.ResponseHandlerDelegate next, System.Threading.CancellationToken cancellationToken);
+ System.Threading.Tasks.Task HandleAsync(MockHttp.Response.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, MockHttp.Response.ResponseHandler nextHandler, System.Threading.CancellationToken cancellationToken);
}
public interface IResponseStrategy
{
- System.Threading.Tasks.Task ProduceResponseAsync(MockHttp.Responses.MockHttpRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
+ System.Threading.Tasks.Task ProduceResponseAsync(MockHttp.Response.MockHttpRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
}
public class MockHttpRequestContext
{
@@ -496,10 +394,5 @@ namespace MockHttp.Responses
public System.Collections.Generic.IReadOnlyDictionary Services { get; }
public bool TryGetService([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out TService? service) { }
}
- public delegate System.Threading.Tasks.Task ResponseHandlerDelegate(MockHttp.Responses.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, System.Threading.CancellationToken cancellationToken);
-}
-namespace MockHttp.Threading
-{
- [System.Obsolete("Will be removed in next version.")]
- public interface IConcurrentReadOnlyCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable { }
+ public delegate System.Threading.Tasks.Task ResponseHandler(MockHttp.Response.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, System.Threading.CancellationToken cancellationToken);
}
\ No newline at end of file
diff --git a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt
index 68ec098b..3fb41422 100644
--- a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt
+++ b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_8.0.verified.txt
@@ -41,7 +41,7 @@ namespace MockHttp
System.Collections.Generic.IReadOnlyCollection Matchers { get; }
System.Net.Http.HttpRequestMessage Request { get; }
}
- public interface IInvokedHttpRequestCollection : MockHttp.Threading.IConcurrentReadOnlyCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
+ public interface IInvokedHttpRequestCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
{
void Clear();
}
@@ -54,9 +54,9 @@ namespace MockHttp
{
public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
public static TResult Respond(this MockHttp.Language.IResponds responds, System.Func response)
where TResult : MockHttp.Language.Flow.IResponseResult { }
@@ -332,7 +332,7 @@ namespace MockHttp.Language
public interface IResponds : MockHttp.IFluentInterface
where out TResult : MockHttp.Language.Flow.IResponseResult
{
- TResult RespondUsing(MockHttp.Responses.IResponseStrategy responseStrategy);
+ TResult RespondUsing(MockHttp.Response.IResponseStrategy responseStrategy);
}
public interface IThrows : MockHttp.IFluentInterface
where out TResult : MockHttp.Language.Flow.IThrowsResult
@@ -363,7 +363,7 @@ namespace MockHttp.Language.Response
}
public interface IWithResponse : MockHttp.IFluentInterface
{
- System.Collections.Generic.IList Behaviors { get; }
+ System.Collections.Generic.IList Behaviors { get; }
}
public interface IWithStatusCode : MockHttp.IFluentInterface, MockHttp.Language.Response.IWithContent, MockHttp.Language.Response.IWithResponse
{
@@ -372,123 +372,21 @@ namespace MockHttp.Language.Response
}
namespace MockHttp.Matchers
{
- public class AnyMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public AnyMatcher(System.Collections.Generic.IReadOnlyCollection matchers) { }
- public bool IsExclusive { get; }
- public System.Collections.Generic.IReadOnlyCollection Matchers { get; }
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class ContentMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public ContentMatcher() { }
- public ContentMatcher(byte[] content) { }
- public ContentMatcher(string content, System.Text.Encoding? encoding) { }
- protected System.Collections.Generic.IReadOnlyList ByteContent { get; }
- public virtual bool IsExclusive { get; }
- protected virtual bool IsMatch(byte[] requestContent) { }
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class ExpressionMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public ExpressionMatcher(System.Linq.Expressions.Expression> expression) { }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class FormDataMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public FormDataMatcher(System.Collections.Generic.IEnumerable>> formData) { }
- public FormDataMatcher(string urlEncodedFormData) { }
- public virtual bool IsExclusive { get; }
- public virtual System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class HttpHeadersMatcher : MockHttp.Matchers.ValueMatcher
- {
- public HttpHeadersMatcher(System.Collections.Generic.IEnumerable>> headers) { }
- public HttpHeadersMatcher(System.Collections.Generic.IEnumerable> headers) { }
- public HttpHeadersMatcher(string name) { }
- public HttpHeadersMatcher(string name, System.Collections.Generic.IEnumerable values) { }
- public HttpHeadersMatcher(string name, string value, bool allowWildcards = false) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class HttpMethodMatcher : MockHttp.Matchers.ValueMatcher
- {
- public HttpMethodMatcher(System.Net.Http.HttpMethod method) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public abstract class HttpRequestMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- protected HttpRequestMatcher() { }
- public virtual bool IsExclusive { get; }
- public abstract bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext);
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public abstract override string ToString() { }
- }
public interface IAsyncHttpRequestMatcher
{
bool IsExclusive { get; }
- System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext);
- }
- public class MediaTypeHeaderMatcher : MockHttp.Matchers.ValueMatcher
- {
- public MediaTypeHeaderMatcher(System.Net.Http.Headers.MediaTypeHeaderValue headerValue) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class PartialContentMatcher : MockHttp.Matchers.ContentMatcher
- {
- public PartialContentMatcher(byte[] content) { }
- public PartialContentMatcher(string content, System.Text.Encoding? encoding) { }
- public override bool IsExclusive { get; }
- protected override bool IsMatch(byte[] requestContent) { }
- public override string ToString() { }
- }
- public class QueryStringMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public QueryStringMatcher(System.Collections.Generic.IEnumerable>> parameters) { }
- public QueryStringMatcher(string queryString) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- [System.Obsolete("Replaced with UriMatcher. Will be removed in next major release.")]
- public class RequestUriMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public RequestUriMatcher(System.Uri uri) { }
- public RequestUriMatcher(string uriString, bool allowWildcards = true) { }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public abstract class ValueMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- protected ValueMatcher(T value) { }
- protected T Value { get; }
- }
- public class VersionMatcher : MockHttp.Matchers.ValueMatcher
- {
- public VersionMatcher(System.Version version) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
+ System.Threading.Tasks.Task IsMatchAsync(MockHttp.Response.MockHttpRequestContext requestContext);
}
}
-namespace MockHttp.Responses
+namespace MockHttp.Response
{
public interface IResponseBehavior
{
- System.Threading.Tasks.Task HandleAsync(MockHttp.Responses.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, MockHttp.Responses.ResponseHandlerDelegate next, System.Threading.CancellationToken cancellationToken);
+ System.Threading.Tasks.Task HandleAsync(MockHttp.Response.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, MockHttp.Response.ResponseHandler nextHandler, System.Threading.CancellationToken cancellationToken);
}
public interface IResponseStrategy
{
- System.Threading.Tasks.Task ProduceResponseAsync(MockHttp.Responses.MockHttpRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
+ System.Threading.Tasks.Task ProduceResponseAsync(MockHttp.Response.MockHttpRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
}
public class MockHttpRequestContext
{
@@ -497,10 +395,5 @@ namespace MockHttp.Responses
public System.Collections.Generic.IReadOnlyDictionary Services { get; }
public bool TryGetService([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out TService? service) { }
}
- public delegate System.Threading.Tasks.Task ResponseHandlerDelegate(MockHttp.Responses.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, System.Threading.CancellationToken cancellationToken);
-}
-namespace MockHttp.Threading
-{
- [System.Obsolete("Will be removed in next version.")]
- public interface IConcurrentReadOnlyCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable { }
+ public delegate System.Threading.Tasks.Task ResponseHandler(MockHttp.Response.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, System.Threading.CancellationToken cancellationToken);
}
\ No newline at end of file
diff --git a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.6.2.verified.txt b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.6.2.verified.txt
index 80865f84..5aa08e99 100644
--- a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.6.2.verified.txt
+++ b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.6.2.verified.txt
@@ -40,7 +40,7 @@ namespace MockHttp
System.Collections.Generic.IReadOnlyCollection Matchers { get; }
System.Net.Http.HttpRequestMessage Request { get; }
}
- public interface IInvokedHttpRequestCollection : MockHttp.Threading.IConcurrentReadOnlyCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
+ public interface IInvokedHttpRequestCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
{
void Clear();
}
@@ -53,9 +53,9 @@ namespace MockHttp
{
public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
public static TResult Respond(this MockHttp.Language.IResponds responds, System.Func response)
where TResult : MockHttp.Language.Flow.IResponseResult { }
@@ -331,7 +331,7 @@ namespace MockHttp.Language
public interface IResponds : MockHttp.IFluentInterface
where out TResult : MockHttp.Language.Flow.IResponseResult
{
- TResult RespondUsing(MockHttp.Responses.IResponseStrategy responseStrategy);
+ TResult RespondUsing(MockHttp.Response.IResponseStrategy responseStrategy);
}
public interface IThrows : MockHttp.IFluentInterface
where out TResult : MockHttp.Language.Flow.IThrowsResult
@@ -362,7 +362,7 @@ namespace MockHttp.Language.Response
}
public interface IWithResponse : MockHttp.IFluentInterface
{
- System.Collections.Generic.IList Behaviors { get; }
+ System.Collections.Generic.IList Behaviors { get; }
}
public interface IWithStatusCode : MockHttp.IFluentInterface, MockHttp.Language.Response.IWithContent, MockHttp.Language.Response.IWithResponse
{
@@ -371,123 +371,21 @@ namespace MockHttp.Language.Response
}
namespace MockHttp.Matchers
{
- public class AnyMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public AnyMatcher(System.Collections.Generic.IReadOnlyCollection matchers) { }
- public bool IsExclusive { get; }
- public System.Collections.Generic.IReadOnlyCollection Matchers { get; }
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class ContentMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public ContentMatcher() { }
- public ContentMatcher(byte[] content) { }
- public ContentMatcher(string content, System.Text.Encoding? encoding) { }
- protected System.Collections.Generic.IReadOnlyList ByteContent { get; }
- public virtual bool IsExclusive { get; }
- protected virtual bool IsMatch(byte[] requestContent) { }
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class ExpressionMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public ExpressionMatcher(System.Linq.Expressions.Expression> expression) { }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class FormDataMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- public FormDataMatcher(System.Collections.Generic.IEnumerable>> formData) { }
- public FormDataMatcher(string urlEncodedFormData) { }
- public virtual bool IsExclusive { get; }
- public virtual System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class HttpHeadersMatcher : MockHttp.Matchers.ValueMatcher
- {
- public HttpHeadersMatcher(System.Collections.Generic.IEnumerable>> headers) { }
- public HttpHeadersMatcher(System.Collections.Generic.IEnumerable> headers) { }
- public HttpHeadersMatcher(string name) { }
- public HttpHeadersMatcher(string name, System.Collections.Generic.IEnumerable values) { }
- public HttpHeadersMatcher(string name, string value, bool allowWildcards = false) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class HttpMethodMatcher : MockHttp.Matchers.ValueMatcher
- {
- public HttpMethodMatcher(System.Net.Http.HttpMethod method) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public abstract class HttpRequestMatcher : MockHttp.Matchers.IAsyncHttpRequestMatcher
- {
- protected HttpRequestMatcher() { }
- public virtual bool IsExclusive { get; }
- public abstract bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext);
- public System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public abstract override string ToString() { }
- }
public interface IAsyncHttpRequestMatcher
{
bool IsExclusive { get; }
- System.Threading.Tasks.Task IsMatchAsync(MockHttp.Responses.MockHttpRequestContext requestContext);
- }
- public class MediaTypeHeaderMatcher : MockHttp.Matchers.ValueMatcher
- {
- public MediaTypeHeaderMatcher(System.Net.Http.Headers.MediaTypeHeaderValue headerValue) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public class PartialContentMatcher : MockHttp.Matchers.ContentMatcher
- {
- public PartialContentMatcher(byte[] content) { }
- public PartialContentMatcher(string content, System.Text.Encoding? encoding) { }
- public override bool IsExclusive { get; }
- protected override bool IsMatch(byte[] requestContent) { }
- public override string ToString() { }
- }
- public class QueryStringMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public QueryStringMatcher(System.Collections.Generic.IEnumerable>> parameters) { }
- public QueryStringMatcher(string queryString) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- [System.Obsolete("Replaced with UriMatcher. Will be removed in next major release.")]
- public class RequestUriMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- public RequestUriMatcher(System.Uri uri) { }
- public RequestUriMatcher(string uriString, bool allowWildcards = true) { }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
- }
- public abstract class ValueMatcher : MockHttp.Matchers.HttpRequestMatcher
- {
- protected ValueMatcher(T value) { }
- protected T Value { get; }
- }
- public class VersionMatcher : MockHttp.Matchers.ValueMatcher
- {
- public VersionMatcher(System.Version version) { }
- public override bool IsExclusive { get; }
- public override bool IsMatch(MockHttp.Responses.MockHttpRequestContext requestContext) { }
- public override string ToString() { }
+ System.Threading.Tasks.Task IsMatchAsync(MockHttp.Response.MockHttpRequestContext requestContext);
}
}
-namespace MockHttp.Responses
+namespace MockHttp.Response
{
public interface IResponseBehavior
{
- System.Threading.Tasks.Task HandleAsync(MockHttp.Responses.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, MockHttp.Responses.ResponseHandlerDelegate next, System.Threading.CancellationToken cancellationToken);
+ System.Threading.Tasks.Task HandleAsync(MockHttp.Response.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, MockHttp.Response.ResponseHandler nextHandler, System.Threading.CancellationToken cancellationToken);
}
public interface IResponseStrategy
{
- System.Threading.Tasks.Task ProduceResponseAsync(MockHttp.Responses.MockHttpRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
+ System.Threading.Tasks.Task ProduceResponseAsync(MockHttp.Response.MockHttpRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
}
public class MockHttpRequestContext
{
@@ -496,10 +394,5 @@ namespace MockHttp.Responses
public System.Collections.Generic.IReadOnlyDictionary Services { get; }
public bool TryGetService([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out TService? service) { }
}
- public delegate System.Threading.Tasks.Task ResponseHandlerDelegate(MockHttp.Responses.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, System.Threading.CancellationToken cancellationToken);
-}
-namespace MockHttp.Threading
-{
- [System.Obsolete("Will be removed in next version.")]
- public interface IConcurrentReadOnlyCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable { }
+ public delegate System.Threading.Tasks.Task ResponseHandler(MockHttp.Response.MockHttpRequestContext requestContext, System.Net.Http.HttpResponseMessage responseMessage, System.Threading.CancellationToken cancellationToken);
}
\ No newline at end of file
diff --git a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.7.2.verified.txt b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.7.2.verified.txt
index d8ce0b97..f37ad0c4 100644
--- a/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.7.2.verified.txt
+++ b/test/MockHttp.Tests/PublicApiTests.Api_has_not_changed.NET_Framework_4.7.2.verified.txt
@@ -40,7 +40,7 @@ namespace MockHttp
System.Collections.Generic.IReadOnlyCollection Matchers { get; }
System.Net.Http.HttpRequestMessage Request { get; }
}
- public interface IInvokedHttpRequestCollection : MockHttp.Threading.IConcurrentReadOnlyCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
+ public interface IInvokedHttpRequestCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable
{
void Clear();
}
@@ -53,9 +53,9 @@ namespace MockHttp
{
public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
- public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
+ public static TResult Respond(this MockHttp.Language.IResponds responds, System.Action with)
where TResult : MockHttp.Language.Flow.IResponseResult { }
public static TResult Respond(this MockHttp.Language.IResponds