From 2d1f44fff526c9c01ee6e57dc62b3fb3f781ecab Mon Sep 17 00:00:00 2001 From: skwasjer <11424653+skwasjer@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:52:27 +0200 Subject: [PATCH 1/2] chore: move enum to own file --- .../Http/HttpHeaderEqualityComparer.cs | 20 ++----------------- src/MockHttp/Http/HttpHeaderMatchType.cs | 19 ++++++++++++++++++ 2 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 src/MockHttp/Http/HttpHeaderMatchType.cs diff --git a/src/MockHttp/Http/HttpHeaderEqualityComparer.cs b/src/MockHttp/Http/HttpHeaderEqualityComparer.cs index 97d8eb1a..e1aac24d 100644 --- a/src/MockHttp/Http/HttpHeaderEqualityComparer.cs +++ b/src/MockHttp/Http/HttpHeaderEqualityComparer.cs @@ -3,22 +3,6 @@ namespace MockHttp.Http; -internal enum HttpHeaderMatchType -{ - /// - /// Header and value(s) match exactly. - /// - Exact, - /// - /// Header name matches, values are ignored. - /// - HeaderNameOnly, - /// - /// Header name matches and all values of left comparand must be in right. - /// - HeaderNameAndPartialValues -} - internal sealed class HttpHeaderEqualityComparer : IEqualityComparer>> { private readonly HttpHeaderMatchType? _matchType; @@ -62,8 +46,8 @@ public bool Equals(KeyValuePair> x, KeyValuePair { string[] headerValues = HttpHeadersCollection.ParseHttpHeaderValue(yValue).ToArray(); - return !_valuePatternMatcher.HasValue && headerValues.Contains(xValue) - || (_valuePatternMatcher.HasValue && headerValues.Any(_valuePatternMatcher.Value.IsMatch)); + return (!_valuePatternMatcher.HasValue && headerValues.Contains(xValue)) + || (_valuePatternMatcher.HasValue && headerValues.Any(_valuePatternMatcher.Value.IsMatch)); }) )) { diff --git a/src/MockHttp/Http/HttpHeaderMatchType.cs b/src/MockHttp/Http/HttpHeaderMatchType.cs new file mode 100644 index 00000000..704ab5eb --- /dev/null +++ b/src/MockHttp/Http/HttpHeaderMatchType.cs @@ -0,0 +1,19 @@ +namespace MockHttp.Http; + +internal enum HttpHeaderMatchType +{ + /// + /// Header and value(s) match exactly. + /// + Exact, + + /// + /// Header name matches, values are ignored. + /// + HeaderNameOnly, + + /// + /// Header name matches and all values of left comparand must be in right. + /// + HeaderNameAndPartialValues +} From 0c0e397f7d9543464cf18fcb6b13be3732c3fd21 Mon Sep 17 00:00:00 2001 From: skwasjer <11424653+skwasjer@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:02:30 +0200 Subject: [PATCH 2/2] chore: move internal types to Internal folder (but do not use it as namespace provider, at least not yet) --- src/MockHttp.Json/DeprecationWarnings.cs | 5 ----- src/MockHttp/{Responses => }/BitRate.cs | 5 ++--- src/MockHttp/DeprecationWarnings.cs | 5 ----- src/MockHttp/Extensions/IRespondsExtensions.cs | 1 + src/MockHttp/Extensions/RequestMatchingExtensions.cs | 2 ++ src/MockHttp/Extensions/ResponseBuilderExtensions.cs | 3 ++- .../{ => Internal}/Extensions/HttpContentExtensions.cs | 4 +--- .../Extensions/HttpRequestMatcherExtensions.cs | 2 +- src/MockHttp/{ => Internal}/Extensions/ListExtensions.cs | 2 +- .../Extensions/NameValueCollectionExtensions.cs | 2 +- .../{ => Internal}/Extensions/ReadOnlyListExtensions.cs | 2 +- src/MockHttp/{ => Internal}/Http/DataEscapingHelper.cs | 0 src/MockHttp/{Responses => Internal/Http}/EmptyContent.cs | 2 +- .../{ => Internal}/Http/HttpHeaderEqualityComparer.cs | 0 src/MockHttp/{ => Internal}/Http/HttpHeaderMatchType.cs | 0 src/MockHttp/{ => Internal}/Http/HttpHeadersCollection.cs | 0 src/MockHttp/{ => Internal}/Http/QueryString.cs | 0 src/MockHttp/{ => Internal}/Http/UriExtensions.cs | 0 src/MockHttp/{ => Internal}/HttpCall.cs | 0 src/MockHttp/{ => Internal}/HttpCallSequence.cs | 0 src/MockHttp/{ => Internal}/InvokedHttpRequest.cs | 0 src/MockHttp/{ => Internal}/InvokedHttpRequestCollection.cs | 0 src/MockHttp/{ => Internal/Request}/AnyRequestMatching.cs | 2 +- .../{ => Internal/Request}/InvertRequestMatching.cs | 2 +- .../Response/Behaviors}/HttpContentBehavior.cs | 4 +++- .../Response/Behaviors}/HttpHeaderBehavior.cs | 3 ++- .../Response/Behaviors}/NetworkLatencyBehavior.cs | 6 ++++-- .../Response/Behaviors}/StatusCodeBehavior.cs | 3 ++- .../Response/Behaviors}/TimeoutBehavior.cs | 3 ++- .../Response/Behaviors}/TransferRateBehavior.cs | 3 ++- .../{Responses => Internal/Response}/ExceptionStrategy.cs | 4 +++- .../Response}/ResponseFuncStrategy.cs | 4 +++- src/MockHttp/{ => Internal}/Threading/AsyncHelpers.cs | 0 .../{ => Internal}/Threading/ConcurrentCollection.cs | 0 src/MockHttp/{ => Internal}/Threading/HighResDelay.cs | 0 .../Language/Flow/Response/EnsureHttpContentBehavior.cs | 3 ++- src/MockHttp/Language/Flow/Response/ResponseBuilder.cs | 2 ++ src/MockHttp/Language/Flow/SetupPhrase.cs | 1 + src/MockHttp/Matchers/AnyMatcher.cs | 1 + src/MockHttp/Matchers/PartialContentMatcher.cs | 1 + src/MockHttp/MockHttp.csproj.DotSettings | 3 ++- src/MockHttp/MockHttpHandler.cs | 1 + src/MockHttp/RequestMatching.cs | 1 + test/MockHttp.Tests/{Responses => }/BitRateTests.cs | 2 +- test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs | 2 +- .../Extensions/RequestMatchingExtensionsTests.cs | 6 +++--- test/MockHttp.Tests/{ => IO}/RateLimitedStreamTests.cs | 3 +-- .../{ => Internal}/Extensions/HttpContentExtensionsTests.cs | 0 .../{ => Internal}/Extensions/ListExtensionsTests.cs | 0 .../Extensions/NameValueCollectionExtensionsTests.cs | 0 .../{ => Internal}/Http/DataEscapingHelperTests.cs | 0 .../{Responses => Internal/Http}/EmptyContentTests.cs | 2 +- .../{ => Internal}/Http/HttpHeadersCollectionTests.cs | 0 test/MockHttp.Tests/{ => Internal}/Http/QueryStringTests.cs | 0 .../{ => Internal}/Http/UriExtensionsTests.cs | 0 test/MockHttp.Tests/{ => Internal}/HttpCallTests.cs | 3 ++- .../{ => Internal/Request}/AnyRequestMatchingTests.cs | 2 +- .../{ => Internal/Request}/InvertRequestMatchingTests.cs | 2 +- .../Response/Behaviors}/TimeoutBehaviorTests.cs | 3 ++- .../Response}/ExceptionStrategyTests.cs | 4 +++- .../Response}/ResponseFuncStrategyTests.cs | 4 +++- .../Threading/ConcurrentCollectionTests.cs} | 0 test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs | 1 + test/MockHttp.Tests/MockHttp.Tests.csproj.DotSettings | 3 +++ test/MockHttp.Tests/RequestMatchingTests.cs | 1 + 65 files changed, 71 insertions(+), 49 deletions(-) delete mode 100644 src/MockHttp.Json/DeprecationWarnings.cs rename src/MockHttp/{Responses => }/BitRate.cs (96%) delete mode 100644 src/MockHttp/DeprecationWarnings.cs rename src/MockHttp/{ => Internal}/Extensions/HttpContentExtensions.cs (95%) rename src/MockHttp/{ => Internal}/Extensions/HttpRequestMatcherExtensions.cs (98%) rename src/MockHttp/{ => Internal}/Extensions/ListExtensions.cs (97%) rename src/MockHttp/{ => Internal}/Extensions/NameValueCollectionExtensions.cs (96%) rename src/MockHttp/{ => Internal}/Extensions/ReadOnlyListExtensions.cs (97%) rename src/MockHttp/{ => Internal}/Http/DataEscapingHelper.cs (100%) rename src/MockHttp/{Responses => Internal/Http}/EmptyContent.cs (97%) rename src/MockHttp/{ => Internal}/Http/HttpHeaderEqualityComparer.cs (100%) rename src/MockHttp/{ => Internal}/Http/HttpHeaderMatchType.cs (100%) rename src/MockHttp/{ => Internal}/Http/HttpHeadersCollection.cs (100%) rename src/MockHttp/{ => Internal}/Http/QueryString.cs (100%) rename src/MockHttp/{ => Internal}/Http/UriExtensions.cs (100%) rename src/MockHttp/{ => Internal}/HttpCall.cs (100%) rename src/MockHttp/{ => Internal}/HttpCallSequence.cs (100%) rename src/MockHttp/{ => Internal}/InvokedHttpRequest.cs (100%) rename src/MockHttp/{ => Internal}/InvokedHttpRequestCollection.cs (100%) rename src/MockHttp/{ => Internal/Request}/AnyRequestMatching.cs (91%) rename src/MockHttp/{ => Internal/Request}/InvertRequestMatching.cs (94%) rename src/MockHttp/{Responses => Internal/Response/Behaviors}/HttpContentBehavior.cs (91%) rename src/MockHttp/{Responses => Internal/Response/Behaviors}/HttpHeaderBehavior.cs (97%) rename src/MockHttp/{Responses => Internal/Response/Behaviors}/NetworkLatencyBehavior.cs (83%) rename src/MockHttp/{Responses => Internal/Response/Behaviors}/StatusCodeBehavior.cs (93%) rename src/MockHttp/{Responses => Internal/Response/Behaviors}/TimeoutBehavior.cs (96%) rename src/MockHttp/{Responses => Internal/Response/Behaviors}/TransferRateBehavior.cs (97%) rename src/MockHttp/{Responses => Internal/Response}/ExceptionStrategy.cs (90%) rename src/MockHttp/{Responses => Internal/Response}/ResponseFuncStrategy.cs (91%) rename src/MockHttp/{ => Internal}/Threading/AsyncHelpers.cs (100%) rename src/MockHttp/{ => Internal}/Threading/ConcurrentCollection.cs (100%) rename src/MockHttp/{ => Internal}/Threading/HighResDelay.cs (100%) rename test/MockHttp.Tests/{Responses => }/BitRateTests.cs (99%) rename test/MockHttp.Tests/{ => IO}/RateLimitedStreamTests.cs (99%) rename test/MockHttp.Tests/{ => Internal}/Extensions/HttpContentExtensionsTests.cs (100%) rename test/MockHttp.Tests/{ => Internal}/Extensions/ListExtensionsTests.cs (100%) rename test/MockHttp.Tests/{ => Internal}/Extensions/NameValueCollectionExtensionsTests.cs (100%) rename test/MockHttp.Tests/{ => Internal}/Http/DataEscapingHelperTests.cs (100%) rename test/MockHttp.Tests/{Responses => Internal/Http}/EmptyContentTests.cs (98%) rename test/MockHttp.Tests/{ => Internal}/Http/HttpHeadersCollectionTests.cs (100%) rename test/MockHttp.Tests/{ => Internal}/Http/QueryStringTests.cs (100%) rename test/MockHttp.Tests/{ => Internal}/Http/UriExtensionsTests.cs (100%) rename test/MockHttp.Tests/{ => Internal}/HttpCallTests.cs (92%) rename test/MockHttp.Tests/{ => Internal/Request}/AnyRequestMatchingTests.cs (98%) rename test/MockHttp.Tests/{ => Internal/Request}/InvertRequestMatchingTests.cs (98%) rename test/MockHttp.Tests/{Responses => Internal/Response/Behaviors}/TimeoutBehaviorTests.cs (97%) rename test/MockHttp.Tests/{Responses => Internal/Response}/ExceptionStrategyTests.cs (95%) rename test/MockHttp.Tests/{Responses => Internal/Response}/ResponseFuncStrategyTests.cs (97%) rename test/MockHttp.Tests/{Threading/InvokedHttpRequestCollectionTests.cs => Internal/Threading/ConcurrentCollectionTests.cs} (100%) create mode 100644 test/MockHttp.Tests/MockHttp.Tests.csproj.DotSettings diff --git a/src/MockHttp.Json/DeprecationWarnings.cs b/src/MockHttp.Json/DeprecationWarnings.cs deleted file mode 100644 index 69090e80..00000000 --- a/src/MockHttp.Json/DeprecationWarnings.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace MockHttp.Json; - -internal static class DeprecationWarnings -{ -} diff --git a/src/MockHttp/Responses/BitRate.cs b/src/MockHttp/BitRate.cs similarity index 96% rename from src/MockHttp/Responses/BitRate.cs rename to src/MockHttp/BitRate.cs index 252eb1ef..65ae9131 100644 --- a/src/MockHttp/Responses/BitRate.cs +++ b/src/MockHttp/BitRate.cs @@ -1,5 +1,4 @@ using System.Globalization; -using MockHttp.IO; // ReSharper disable once CheckNamespace namespace MockHttp; @@ -85,7 +84,7 @@ public static BitRate OneGigabit() /// /// /// - public static explicit operator int (BitRate bitRate) + public static explicit operator int(BitRate bitRate) { return ToInt32(bitRate); } @@ -95,7 +94,7 @@ public static explicit operator int (BitRate bitRate) /// /// /// - public static explicit operator BitRate (int bitRate) + public static explicit operator BitRate(int bitRate) { return FromInt32(bitRate); } diff --git a/src/MockHttp/DeprecationWarnings.cs b/src/MockHttp/DeprecationWarnings.cs deleted file mode 100644 index f0e5c2df..00000000 --- a/src/MockHttp/DeprecationWarnings.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace MockHttp; - -internal static class DeprecationWarnings -{ -} diff --git a/src/MockHttp/Extensions/IRespondsExtensions.cs b/src/MockHttp/Extensions/IRespondsExtensions.cs index b38a0ce8..b04cd2cf 100644 --- a/src/MockHttp/Extensions/IRespondsExtensions.cs +++ b/src/MockHttp/Extensions/IRespondsExtensions.cs @@ -1,6 +1,7 @@ using MockHttp.Language; using MockHttp.Language.Flow; using MockHttp.Language.Flow.Response; +using MockHttp.Response; using MockHttp.Responses; namespace MockHttp; diff --git a/src/MockHttp/Extensions/RequestMatchingExtensions.cs b/src/MockHttp/Extensions/RequestMatchingExtensions.cs index d2b9106a..3a9baf6d 100644 --- a/src/MockHttp/Extensions/RequestMatchingExtensions.cs +++ b/src/MockHttp/Extensions/RequestMatchingExtensions.cs @@ -5,9 +5,11 @@ using System.Linq.Expressions; using System.Net.Http.Headers; using System.Text; +using MockHttp.Extensions; using MockHttp.Http; using MockHttp.Matchers; using MockHttp.Patterns; +using MockHttp.Request; using static MockHttp.Http.UriExtensions; namespace MockHttp; diff --git a/src/MockHttp/Extensions/ResponseBuilderExtensions.cs b/src/MockHttp/Extensions/ResponseBuilderExtensions.cs index 8ae76e82..8a3776ba 100644 --- a/src/MockHttp/Extensions/ResponseBuilderExtensions.cs +++ b/src/MockHttp/Extensions/ResponseBuilderExtensions.cs @@ -3,11 +3,12 @@ using System.Net; using System.Net.Http.Headers; using System.Text; +using MockHttp.Extensions; using MockHttp.Http; using MockHttp.IO; using MockHttp.Language.Flow.Response; using MockHttp.Language.Response; -using MockHttp.Responses; +using MockHttp.Response.Behaviors; namespace MockHttp; diff --git a/src/MockHttp/Extensions/HttpContentExtensions.cs b/src/MockHttp/Internal/Extensions/HttpContentExtensions.cs similarity index 95% rename from src/MockHttp/Extensions/HttpContentExtensions.cs rename to src/MockHttp/Internal/Extensions/HttpContentExtensions.cs index 30db7445..66ba0e2a 100644 --- a/src/MockHttp/Extensions/HttpContentExtensions.cs +++ b/src/MockHttp/Internal/Extensions/HttpContentExtensions.cs @@ -1,6 +1,4 @@ -using System.Diagnostics.CodeAnalysis; - -namespace MockHttp; +namespace MockHttp.Extensions; internal static class HttpContentExtensions { diff --git a/src/MockHttp/Extensions/HttpRequestMatcherExtensions.cs b/src/MockHttp/Internal/Extensions/HttpRequestMatcherExtensions.cs similarity index 98% rename from src/MockHttp/Extensions/HttpRequestMatcherExtensions.cs rename to src/MockHttp/Internal/Extensions/HttpRequestMatcherExtensions.cs index a0873214..399752c5 100644 --- a/src/MockHttp/Extensions/HttpRequestMatcherExtensions.cs +++ b/src/MockHttp/Internal/Extensions/HttpRequestMatcherExtensions.cs @@ -1,7 +1,7 @@ using MockHttp.Matchers; using MockHttp.Responses; -namespace MockHttp; +namespace MockHttp.Extensions; internal static class HttpRequestMatcherExtensions { diff --git a/src/MockHttp/Extensions/ListExtensions.cs b/src/MockHttp/Internal/Extensions/ListExtensions.cs similarity index 97% rename from src/MockHttp/Extensions/ListExtensions.cs rename to src/MockHttp/Internal/Extensions/ListExtensions.cs index cd060a47..ba76b87c 100644 --- a/src/MockHttp/Extensions/ListExtensions.cs +++ b/src/MockHttp/Internal/Extensions/ListExtensions.cs @@ -1,4 +1,4 @@ -namespace MockHttp; +namespace MockHttp.Extensions; internal static class ListExtensions { diff --git a/src/MockHttp/Extensions/NameValueCollectionExtensions.cs b/src/MockHttp/Internal/Extensions/NameValueCollectionExtensions.cs similarity index 96% rename from src/MockHttp/Extensions/NameValueCollectionExtensions.cs rename to src/MockHttp/Internal/Extensions/NameValueCollectionExtensions.cs index 4228b432..44b1af1f 100644 --- a/src/MockHttp/Extensions/NameValueCollectionExtensions.cs +++ b/src/MockHttp/Internal/Extensions/NameValueCollectionExtensions.cs @@ -1,6 +1,6 @@ using System.Collections.Specialized; -namespace MockHttp; +namespace MockHttp.Extensions; internal static class NameValueCollectionExtensions { diff --git a/src/MockHttp/Extensions/ReadOnlyListExtensions.cs b/src/MockHttp/Internal/Extensions/ReadOnlyListExtensions.cs similarity index 97% rename from src/MockHttp/Extensions/ReadOnlyListExtensions.cs rename to src/MockHttp/Internal/Extensions/ReadOnlyListExtensions.cs index 3524c5b4..204d9e1b 100644 --- a/src/MockHttp/Extensions/ReadOnlyListExtensions.cs +++ b/src/MockHttp/Internal/Extensions/ReadOnlyListExtensions.cs @@ -1,4 +1,4 @@ -namespace MockHttp; +namespace MockHttp.Extensions; internal static class ReadOnlyListExtensions { diff --git a/src/MockHttp/Http/DataEscapingHelper.cs b/src/MockHttp/Internal/Http/DataEscapingHelper.cs similarity index 100% rename from src/MockHttp/Http/DataEscapingHelper.cs rename to src/MockHttp/Internal/Http/DataEscapingHelper.cs diff --git a/src/MockHttp/Responses/EmptyContent.cs b/src/MockHttp/Internal/Http/EmptyContent.cs similarity index 97% rename from src/MockHttp/Responses/EmptyContent.cs rename to src/MockHttp/Internal/Http/EmptyContent.cs index 79d511a7..555d1adb 100644 --- a/src/MockHttp/Responses/EmptyContent.cs +++ b/src/MockHttp/Internal/Http/EmptyContent.cs @@ -1,7 +1,7 @@ #pragma warning disable S4136 using System.Net; -namespace MockHttp.Responses; +namespace MockHttp.Http; internal class EmptyContent : HttpContent { diff --git a/src/MockHttp/Http/HttpHeaderEqualityComparer.cs b/src/MockHttp/Internal/Http/HttpHeaderEqualityComparer.cs similarity index 100% rename from src/MockHttp/Http/HttpHeaderEqualityComparer.cs rename to src/MockHttp/Internal/Http/HttpHeaderEqualityComparer.cs diff --git a/src/MockHttp/Http/HttpHeaderMatchType.cs b/src/MockHttp/Internal/Http/HttpHeaderMatchType.cs similarity index 100% rename from src/MockHttp/Http/HttpHeaderMatchType.cs rename to src/MockHttp/Internal/Http/HttpHeaderMatchType.cs diff --git a/src/MockHttp/Http/HttpHeadersCollection.cs b/src/MockHttp/Internal/Http/HttpHeadersCollection.cs similarity index 100% rename from src/MockHttp/Http/HttpHeadersCollection.cs rename to src/MockHttp/Internal/Http/HttpHeadersCollection.cs diff --git a/src/MockHttp/Http/QueryString.cs b/src/MockHttp/Internal/Http/QueryString.cs similarity index 100% rename from src/MockHttp/Http/QueryString.cs rename to src/MockHttp/Internal/Http/QueryString.cs diff --git a/src/MockHttp/Http/UriExtensions.cs b/src/MockHttp/Internal/Http/UriExtensions.cs similarity index 100% rename from src/MockHttp/Http/UriExtensions.cs rename to src/MockHttp/Internal/Http/UriExtensions.cs diff --git a/src/MockHttp/HttpCall.cs b/src/MockHttp/Internal/HttpCall.cs similarity index 100% rename from src/MockHttp/HttpCall.cs rename to src/MockHttp/Internal/HttpCall.cs diff --git a/src/MockHttp/HttpCallSequence.cs b/src/MockHttp/Internal/HttpCallSequence.cs similarity index 100% rename from src/MockHttp/HttpCallSequence.cs rename to src/MockHttp/Internal/HttpCallSequence.cs diff --git a/src/MockHttp/InvokedHttpRequest.cs b/src/MockHttp/Internal/InvokedHttpRequest.cs similarity index 100% rename from src/MockHttp/InvokedHttpRequest.cs rename to src/MockHttp/Internal/InvokedHttpRequest.cs diff --git a/src/MockHttp/InvokedHttpRequestCollection.cs b/src/MockHttp/Internal/InvokedHttpRequestCollection.cs similarity index 100% rename from src/MockHttp/InvokedHttpRequestCollection.cs rename to src/MockHttp/Internal/InvokedHttpRequestCollection.cs diff --git a/src/MockHttp/AnyRequestMatching.cs b/src/MockHttp/Internal/Request/AnyRequestMatching.cs similarity index 91% rename from src/MockHttp/AnyRequestMatching.cs rename to src/MockHttp/Internal/Request/AnyRequestMatching.cs index 49579f82..67f7e6f8 100644 --- a/src/MockHttp/AnyRequestMatching.cs +++ b/src/MockHttp/Internal/Request/AnyRequestMatching.cs @@ -1,6 +1,6 @@ using MockHttp.Matchers; -namespace MockHttp; +namespace MockHttp.Request; /// /// A builder to configure request matchers, accepting all matchers. diff --git a/src/MockHttp/InvertRequestMatching.cs b/src/MockHttp/Internal/Request/InvertRequestMatching.cs similarity index 94% rename from src/MockHttp/InvertRequestMatching.cs rename to src/MockHttp/Internal/Request/InvertRequestMatching.cs index b58317d2..09a7cb58 100644 --- a/src/MockHttp/InvertRequestMatching.cs +++ b/src/MockHttp/Internal/Request/InvertRequestMatching.cs @@ -1,6 +1,6 @@ using MockHttp.Matchers; -namespace MockHttp; +namespace MockHttp.Request; internal sealed class InvertRequestMatching : RequestMatching { diff --git a/src/MockHttp/Responses/HttpContentBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/HttpContentBehavior.cs similarity index 91% rename from src/MockHttp/Responses/HttpContentBehavior.cs rename to src/MockHttp/Internal/Response/Behaviors/HttpContentBehavior.cs index c15d7fcf..e701590d 100644 --- a/src/MockHttp/Responses/HttpContentBehavior.cs +++ b/src/MockHttp/Internal/Response/Behaviors/HttpContentBehavior.cs @@ -1,4 +1,6 @@ -namespace MockHttp.Responses; +using MockHttp.Responses; + +namespace MockHttp.Response.Behaviors; internal sealed class HttpContentBehavior : IResponseBehavior diff --git a/src/MockHttp/Responses/HttpHeaderBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/HttpHeaderBehavior.cs similarity index 97% rename from src/MockHttp/Responses/HttpHeaderBehavior.cs rename to src/MockHttp/Internal/Response/Behaviors/HttpHeaderBehavior.cs index 92094dc0..314e9bf0 100644 --- a/src/MockHttp/Responses/HttpHeaderBehavior.cs +++ b/src/MockHttp/Internal/Response/Behaviors/HttpHeaderBehavior.cs @@ -1,6 +1,7 @@ using MockHttp.Http; +using MockHttp.Responses; -namespace MockHttp.Responses; +namespace MockHttp.Response.Behaviors; internal sealed class HttpHeaderBehavior : IResponseBehavior diff --git a/src/MockHttp/Responses/NetworkLatencyBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/NetworkLatencyBehavior.cs similarity index 83% rename from src/MockHttp/Responses/NetworkLatencyBehavior.cs rename to src/MockHttp/Internal/Response/Behaviors/NetworkLatencyBehavior.cs index e7b666af..18eeeb71 100644 --- a/src/MockHttp/Responses/NetworkLatencyBehavior.cs +++ b/src/MockHttp/Internal/Response/Behaviors/NetworkLatencyBehavior.cs @@ -1,6 +1,8 @@ -namespace MockHttp.Responses; +using MockHttp.Responses; -internal class NetworkLatencyBehavior +namespace MockHttp.Response.Behaviors; + +internal sealed class NetworkLatencyBehavior : IResponseBehavior { private readonly NetworkLatency _networkLatency; diff --git a/src/MockHttp/Responses/StatusCodeBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/StatusCodeBehavior.cs similarity index 93% rename from src/MockHttp/Responses/StatusCodeBehavior.cs rename to src/MockHttp/Internal/Response/Behaviors/StatusCodeBehavior.cs index a16137f3..a9a3c9c0 100644 --- a/src/MockHttp/Responses/StatusCodeBehavior.cs +++ b/src/MockHttp/Internal/Response/Behaviors/StatusCodeBehavior.cs @@ -1,6 +1,7 @@ using System.Net; +using MockHttp.Responses; -namespace MockHttp.Responses; +namespace MockHttp.Response.Behaviors; internal sealed class StatusCodeBehavior : IResponseBehavior diff --git a/src/MockHttp/Responses/TimeoutBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/TimeoutBehavior.cs similarity index 96% rename from src/MockHttp/Responses/TimeoutBehavior.cs rename to src/MockHttp/Internal/Response/Behaviors/TimeoutBehavior.cs index 8c02257d..ea934661 100644 --- a/src/MockHttp/Responses/TimeoutBehavior.cs +++ b/src/MockHttp/Internal/Response/Behaviors/TimeoutBehavior.cs @@ -1,7 +1,8 @@ using System.Runtime.InteropServices; +using MockHttp.Responses; using MockHttp.Threading; -namespace MockHttp.Responses; +namespace MockHttp.Response.Behaviors; internal sealed class TimeoutBehavior : IResponseBehavior diff --git a/src/MockHttp/Responses/TransferRateBehavior.cs b/src/MockHttp/Internal/Response/Behaviors/TransferRateBehavior.cs similarity index 97% rename from src/MockHttp/Responses/TransferRateBehavior.cs rename to src/MockHttp/Internal/Response/Behaviors/TransferRateBehavior.cs index 94a3d9b2..cd6d830f 100644 --- a/src/MockHttp/Responses/TransferRateBehavior.cs +++ b/src/MockHttp/Internal/Response/Behaviors/TransferRateBehavior.cs @@ -1,7 +1,8 @@ using System.Net; using MockHttp.IO; +using MockHttp.Responses; -namespace MockHttp.Responses; +namespace MockHttp.Response.Behaviors; internal sealed class TransferRateBehavior : IResponseBehavior { diff --git a/src/MockHttp/Responses/ExceptionStrategy.cs b/src/MockHttp/Internal/Response/ExceptionStrategy.cs similarity index 90% rename from src/MockHttp/Responses/ExceptionStrategy.cs rename to src/MockHttp/Internal/Response/ExceptionStrategy.cs index 61636cc5..41e1a66f 100644 --- a/src/MockHttp/Responses/ExceptionStrategy.cs +++ b/src/MockHttp/Internal/Response/ExceptionStrategy.cs @@ -1,4 +1,6 @@ -namespace MockHttp.Responses; +using MockHttp.Responses; + +namespace MockHttp.Response; internal sealed class ExceptionStrategy : IResponseStrategy { diff --git a/src/MockHttp/Responses/ResponseFuncStrategy.cs b/src/MockHttp/Internal/Response/ResponseFuncStrategy.cs similarity index 91% rename from src/MockHttp/Responses/ResponseFuncStrategy.cs rename to src/MockHttp/Internal/Response/ResponseFuncStrategy.cs index 34485802..07bf1418 100644 --- a/src/MockHttp/Responses/ResponseFuncStrategy.cs +++ b/src/MockHttp/Internal/Response/ResponseFuncStrategy.cs @@ -1,4 +1,6 @@ -namespace MockHttp.Responses; +using MockHttp.Responses; + +namespace MockHttp.Response; internal sealed class ResponseFuncStrategy : IResponseStrategy { diff --git a/src/MockHttp/Threading/AsyncHelpers.cs b/src/MockHttp/Internal/Threading/AsyncHelpers.cs similarity index 100% rename from src/MockHttp/Threading/AsyncHelpers.cs rename to src/MockHttp/Internal/Threading/AsyncHelpers.cs diff --git a/src/MockHttp/Threading/ConcurrentCollection.cs b/src/MockHttp/Internal/Threading/ConcurrentCollection.cs similarity index 100% rename from src/MockHttp/Threading/ConcurrentCollection.cs rename to src/MockHttp/Internal/Threading/ConcurrentCollection.cs diff --git a/src/MockHttp/Threading/HighResDelay.cs b/src/MockHttp/Internal/Threading/HighResDelay.cs similarity index 100% rename from src/MockHttp/Threading/HighResDelay.cs rename to src/MockHttp/Internal/Threading/HighResDelay.cs diff --git a/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs b/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs index 9cf0ac18..bd3e6bf6 100644 --- a/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs +++ b/src/MockHttp/Language/Flow/Response/EnsureHttpContentBehavior.cs @@ -1,4 +1,5 @@ -using MockHttp.Responses; +using MockHttp.Http; +using MockHttp.Responses; namespace MockHttp.Language.Flow.Response; diff --git a/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs b/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs index b028d00d..d38e27db 100644 --- a/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs +++ b/src/MockHttp/Language/Flow/Response/ResponseBuilder.cs @@ -1,7 +1,9 @@ using System.Collections.ObjectModel; using System.Net; using System.Net.Http.Headers; +using MockHttp.Extensions; using MockHttp.Http; +using MockHttp.Response.Behaviors; using MockHttp.Responses; namespace MockHttp.Language.Flow.Response; diff --git a/src/MockHttp/Language/Flow/SetupPhrase.cs b/src/MockHttp/Language/Flow/SetupPhrase.cs index 588d61e6..dce15751 100644 --- a/src/MockHttp/Language/Flow/SetupPhrase.cs +++ b/src/MockHttp/Language/Flow/SetupPhrase.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using MockHttp.Response; using MockHttp.Responses; namespace MockHttp.Language.Flow; diff --git a/src/MockHttp/Matchers/AnyMatcher.cs b/src/MockHttp/Matchers/AnyMatcher.cs index 669ad69c..5018af87 100644 --- a/src/MockHttp/Matchers/AnyMatcher.cs +++ b/src/MockHttp/Matchers/AnyMatcher.cs @@ -1,4 +1,5 @@ using System.Text; +using MockHttp.Extensions; using MockHttp.Responses; namespace MockHttp.Matchers; diff --git a/src/MockHttp/Matchers/PartialContentMatcher.cs b/src/MockHttp/Matchers/PartialContentMatcher.cs index 2c849484..9604c01b 100644 --- a/src/MockHttp/Matchers/PartialContentMatcher.cs +++ b/src/MockHttp/Matchers/PartialContentMatcher.cs @@ -1,4 +1,5 @@ using System.Text; +using MockHttp.Extensions; namespace MockHttp.Matchers; diff --git a/src/MockHttp/MockHttp.csproj.DotSettings b/src/MockHttp/MockHttp.csproj.DotSettings index 17962b13..65c8ae9d 100644 --- a/src/MockHttp/MockHttp.csproj.DotSettings +++ b/src/MockHttp/MockHttp.csproj.DotSettings @@ -1,2 +1,3 @@  - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/src/MockHttp/MockHttpHandler.cs b/src/MockHttp/MockHttpHandler.cs index 1aa48c41..9c4a64ac 100644 --- a/src/MockHttp/MockHttpHandler.cs +++ b/src/MockHttp/MockHttpHandler.cs @@ -1,6 +1,7 @@ using System.Collections.ObjectModel; using System.Net; using System.Text; +using MockHttp.Extensions; using MockHttp.Language; using MockHttp.Language.Flow; using MockHttp.Matchers; diff --git a/src/MockHttp/RequestMatching.cs b/src/MockHttp/RequestMatching.cs index e38494a1..8d1a3969 100644 --- a/src/MockHttp/RequestMatching.cs +++ b/src/MockHttp/RequestMatching.cs @@ -1,6 +1,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using MockHttp.Matchers; +using MockHttp.Request; namespace MockHttp; diff --git a/test/MockHttp.Tests/Responses/BitRateTests.cs b/test/MockHttp.Tests/BitRateTests.cs similarity index 99% rename from test/MockHttp.Tests/Responses/BitRateTests.cs rename to test/MockHttp.Tests/BitRateTests.cs index 3cf2aba2..4615e71e 100644 --- a/test/MockHttp.Tests/Responses/BitRateTests.cs +++ b/test/MockHttp.Tests/BitRateTests.cs @@ -1,6 +1,6 @@ using static MockHttp.BitRate; -namespace MockHttp.Responses; +namespace MockHttp; public sealed class BitRateTests { diff --git a/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs b/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs index 119b617a..12c51bc2 100644 --- a/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs +++ b/test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs @@ -5,7 +5,7 @@ using MockHttp.Language.Flow; using MockHttp.Responses; -namespace MockHttp.Extensions; +namespace MockHttp; public class IRespondsExtensionsTests { diff --git a/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs b/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs index ecf526dc..62c679bb 100644 --- a/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs +++ b/test/MockHttp.Tests/Extensions/RequestMatchingExtensionsTests.cs @@ -1,15 +1,15 @@ -using System; -using System.Collections.Specialized; +using System.Collections.Specialized; using System.Linq.Expressions; using System.Net.Http.Headers; using System.Text; using System.Xml; +using MockHttp.Extensions; using MockHttp.Http; using MockHttp.Matchers; using MockHttp.Responses; using static MockHttp.Http.UriExtensions; -namespace MockHttp.Extensions; +namespace MockHttp; public abstract class RequestMatchingExtensionsTests { diff --git a/test/MockHttp.Tests/RateLimitedStreamTests.cs b/test/MockHttp.Tests/IO/RateLimitedStreamTests.cs similarity index 99% rename from test/MockHttp.Tests/RateLimitedStreamTests.cs rename to test/MockHttp.Tests/IO/RateLimitedStreamTests.cs index 2b694d8c..e6903692 100644 --- a/test/MockHttp.Tests/RateLimitedStreamTests.cs +++ b/test/MockHttp.Tests/IO/RateLimitedStreamTests.cs @@ -1,8 +1,7 @@ using System.Diagnostics; -using MockHttp.IO; using Xunit.Abstractions; -namespace MockHttp; +namespace MockHttp.IO; public sealed class RateLimitedStreamTests : IDisposable { diff --git a/test/MockHttp.Tests/Extensions/HttpContentExtensionsTests.cs b/test/MockHttp.Tests/Internal/Extensions/HttpContentExtensionsTests.cs similarity index 100% rename from test/MockHttp.Tests/Extensions/HttpContentExtensionsTests.cs rename to test/MockHttp.Tests/Internal/Extensions/HttpContentExtensionsTests.cs diff --git a/test/MockHttp.Tests/Extensions/ListExtensionsTests.cs b/test/MockHttp.Tests/Internal/Extensions/ListExtensionsTests.cs similarity index 100% rename from test/MockHttp.Tests/Extensions/ListExtensionsTests.cs rename to test/MockHttp.Tests/Internal/Extensions/ListExtensionsTests.cs diff --git a/test/MockHttp.Tests/Extensions/NameValueCollectionExtensionsTests.cs b/test/MockHttp.Tests/Internal/Extensions/NameValueCollectionExtensionsTests.cs similarity index 100% rename from test/MockHttp.Tests/Extensions/NameValueCollectionExtensionsTests.cs rename to test/MockHttp.Tests/Internal/Extensions/NameValueCollectionExtensionsTests.cs diff --git a/test/MockHttp.Tests/Http/DataEscapingHelperTests.cs b/test/MockHttp.Tests/Internal/Http/DataEscapingHelperTests.cs similarity index 100% rename from test/MockHttp.Tests/Http/DataEscapingHelperTests.cs rename to test/MockHttp.Tests/Internal/Http/DataEscapingHelperTests.cs diff --git a/test/MockHttp.Tests/Responses/EmptyContentTests.cs b/test/MockHttp.Tests/Internal/Http/EmptyContentTests.cs similarity index 98% rename from test/MockHttp.Tests/Responses/EmptyContentTests.cs rename to test/MockHttp.Tests/Internal/Http/EmptyContentTests.cs index 0da426f2..e15b991a 100644 --- a/test/MockHttp.Tests/Responses/EmptyContentTests.cs +++ b/test/MockHttp.Tests/Internal/Http/EmptyContentTests.cs @@ -1,6 +1,6 @@ using System.Net; -namespace MockHttp.Responses; +namespace MockHttp.Http; public class EmptyContentTests { diff --git a/test/MockHttp.Tests/Http/HttpHeadersCollectionTests.cs b/test/MockHttp.Tests/Internal/Http/HttpHeadersCollectionTests.cs similarity index 100% rename from test/MockHttp.Tests/Http/HttpHeadersCollectionTests.cs rename to test/MockHttp.Tests/Internal/Http/HttpHeadersCollectionTests.cs diff --git a/test/MockHttp.Tests/Http/QueryStringTests.cs b/test/MockHttp.Tests/Internal/Http/QueryStringTests.cs similarity index 100% rename from test/MockHttp.Tests/Http/QueryStringTests.cs rename to test/MockHttp.Tests/Internal/Http/QueryStringTests.cs diff --git a/test/MockHttp.Tests/Http/UriExtensionsTests.cs b/test/MockHttp.Tests/Internal/Http/UriExtensionsTests.cs similarity index 100% rename from test/MockHttp.Tests/Http/UriExtensionsTests.cs rename to test/MockHttp.Tests/Internal/Http/UriExtensionsTests.cs diff --git a/test/MockHttp.Tests/HttpCallTests.cs b/test/MockHttp.Tests/Internal/HttpCallTests.cs similarity index 92% rename from test/MockHttp.Tests/HttpCallTests.cs rename to test/MockHttp.Tests/Internal/HttpCallTests.cs index 4b0e5147..0717bfe5 100644 --- a/test/MockHttp.Tests/HttpCallTests.cs +++ b/test/MockHttp.Tests/Internal/HttpCallTests.cs @@ -1,4 +1,5 @@ -using MockHttp.Responses; +using MockHttp.Response; +using MockHttp.Responses; namespace MockHttp; diff --git a/test/MockHttp.Tests/AnyRequestMatchingTests.cs b/test/MockHttp.Tests/Internal/Request/AnyRequestMatchingTests.cs similarity index 98% rename from test/MockHttp.Tests/AnyRequestMatchingTests.cs rename to test/MockHttp.Tests/Internal/Request/AnyRequestMatchingTests.cs index 21995f62..474dfbe8 100644 --- a/test/MockHttp.Tests/AnyRequestMatchingTests.cs +++ b/test/MockHttp.Tests/Internal/Request/AnyRequestMatchingTests.cs @@ -1,6 +1,6 @@ using MockHttp.Matchers; -namespace MockHttp; +namespace MockHttp.Request; public class AnyRequestMatchingTests { diff --git a/test/MockHttp.Tests/InvertRequestMatchingTests.cs b/test/MockHttp.Tests/Internal/Request/InvertRequestMatchingTests.cs similarity index 98% rename from test/MockHttp.Tests/InvertRequestMatchingTests.cs rename to test/MockHttp.Tests/Internal/Request/InvertRequestMatchingTests.cs index 606249fb..1d5161f8 100644 --- a/test/MockHttp.Tests/InvertRequestMatchingTests.cs +++ b/test/MockHttp.Tests/Internal/Request/InvertRequestMatchingTests.cs @@ -1,6 +1,6 @@ using System.Net; -namespace MockHttp; +namespace MockHttp.Request; public sealed class InvertRequestMatchingTests : IDisposable { diff --git a/test/MockHttp.Tests/Responses/TimeoutBehaviorTests.cs b/test/MockHttp.Tests/Internal/Response/Behaviors/TimeoutBehaviorTests.cs similarity index 97% rename from test/MockHttp.Tests/Responses/TimeoutBehaviorTests.cs rename to test/MockHttp.Tests/Internal/Response/Behaviors/TimeoutBehaviorTests.cs index 00d05fe1..0f88e407 100644 --- a/test/MockHttp.Tests/Responses/TimeoutBehaviorTests.cs +++ b/test/MockHttp.Tests/Internal/Response/Behaviors/TimeoutBehaviorTests.cs @@ -1,6 +1,7 @@ using System.Diagnostics; +using MockHttp.Responses; -namespace MockHttp.Responses; +namespace MockHttp.Response.Behaviors; public class TimeoutBehaviorTests { diff --git a/test/MockHttp.Tests/Responses/ExceptionStrategyTests.cs b/test/MockHttp.Tests/Internal/Response/ExceptionStrategyTests.cs similarity index 95% rename from test/MockHttp.Tests/Responses/ExceptionStrategyTests.cs rename to test/MockHttp.Tests/Internal/Response/ExceptionStrategyTests.cs index 5cf66acf..15026db4 100644 --- a/test/MockHttp.Tests/Responses/ExceptionStrategyTests.cs +++ b/test/MockHttp.Tests/Internal/Response/ExceptionStrategyTests.cs @@ -1,4 +1,6 @@ -namespace MockHttp.Responses; +using MockHttp.Responses; + +namespace MockHttp.Response; public class ExceptionStrategyTests { diff --git a/test/MockHttp.Tests/Responses/ResponseFuncStrategyTests.cs b/test/MockHttp.Tests/Internal/Response/ResponseFuncStrategyTests.cs similarity index 97% rename from test/MockHttp.Tests/Responses/ResponseFuncStrategyTests.cs rename to test/MockHttp.Tests/Internal/Response/ResponseFuncStrategyTests.cs index 523a06e2..5e51aff6 100644 --- a/test/MockHttp.Tests/Responses/ResponseFuncStrategyTests.cs +++ b/test/MockHttp.Tests/Internal/Response/ResponseFuncStrategyTests.cs @@ -1,4 +1,6 @@ -namespace MockHttp.Responses; +using MockHttp.Responses; + +namespace MockHttp.Response; public class ResponseFuncStrategyTests { diff --git a/test/MockHttp.Tests/Threading/InvokedHttpRequestCollectionTests.cs b/test/MockHttp.Tests/Internal/Threading/ConcurrentCollectionTests.cs similarity index 100% rename from test/MockHttp.Tests/Threading/InvokedHttpRequestCollectionTests.cs rename to test/MockHttp.Tests/Internal/Threading/ConcurrentCollectionTests.cs diff --git a/test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs b/test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs index 0a0943ad..10fc86df 100644 --- a/test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs +++ b/test/MockHttp.Tests/Matchers/RequestUriMatcherTests.cs @@ -2,6 +2,7 @@ namespace MockHttp.Matchers; +[Obsolete($"Replaced with {nameof(UriMatcher)}. Will be removed in next major release.")] public class RequestUriMatcherTests { [Theory] diff --git a/test/MockHttp.Tests/MockHttp.Tests.csproj.DotSettings b/test/MockHttp.Tests/MockHttp.Tests.csproj.DotSettings new file mode 100644 index 00000000..65c8ae9d --- /dev/null +++ b/test/MockHttp.Tests/MockHttp.Tests.csproj.DotSettings @@ -0,0 +1,3 @@ + + True + True \ No newline at end of file diff --git a/test/MockHttp.Tests/RequestMatchingTests.cs b/test/MockHttp.Tests/RequestMatchingTests.cs index 16150d44..ff70b60e 100644 --- a/test/MockHttp.Tests/RequestMatchingTests.cs +++ b/test/MockHttp.Tests/RequestMatchingTests.cs @@ -1,4 +1,5 @@ using MockHttp.Matchers; +using MockHttp.Request; namespace MockHttp;