Use NuGet "Stef.Validation" (#707)

* Use NuGet "Stef.Validation"

* nuget

* .
This commit is contained in:
Stef Heyenrath
2021-12-30 10:44:50 +01:00
committed by GitHub
parent fd1f4968b4
commit e8e28c21a1
77 changed files with 267 additions and 421 deletions

View File

@@ -3,7 +3,7 @@ using System;
using System.Linq;
using WireMock.Types;
using WireMock.Util;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -70,7 +70,7 @@ namespace WireMock.Matchers.Request
/// <param name="func">The function.</param>
public RequestMessageBodyMatcher([NotNull] Func<string, bool> func)
{
Check.NotNull(func, nameof(func));
Guard.NotNull(func, nameof(func));
Func = func;
}
@@ -80,7 +80,7 @@ namespace WireMock.Matchers.Request
/// <param name="func">The function.</param>
public RequestMessageBodyMatcher([NotNull] Func<byte[], bool> func)
{
Check.NotNull(func, nameof(func));
Guard.NotNull(func, nameof(func));
DataFunc = func;
}
@@ -90,7 +90,7 @@ namespace WireMock.Matchers.Request
/// <param name="func">The function.</param>
public RequestMessageBodyMatcher([NotNull] Func<object, bool> func)
{
Check.NotNull(func, nameof(func));
Guard.NotNull(func, nameof(func));
JsonFunc = func;
}
@@ -100,7 +100,7 @@ namespace WireMock.Matchers.Request
/// <param name="func">The function.</param>
public RequestMessageBodyMatcher([NotNull] Func<IBodyData, bool> func)
{
Check.NotNull(func, nameof(func));
Guard.NotNull(func, nameof(func));
BodyDataFunc = func;
}
@@ -110,7 +110,7 @@ namespace WireMock.Matchers.Request
/// <param name="matchers">The matchers.</param>
public RequestMessageBodyMatcher([NotNull] params IMatcher[] matchers)
{
Check.NotNull(matchers, nameof(matchers));
Guard.NotNull(matchers, nameof(matchers));
Matchers = matchers;
}

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -36,7 +36,7 @@ namespace WireMock.Matchers.Request
/// <param name="matchers">The matchers.</param>
public RequestMessageClientIPMatcher([NotNull] params IStringMatcher[] matchers)
{
Check.NotNull(matchers, nameof(matchers));
Guard.NotNull(matchers, nameof(matchers));
Matchers = matchers;
}
@@ -46,7 +46,7 @@ namespace WireMock.Matchers.Request
/// <param name="funcs">The clientIP functions.</param>
public RequestMessageClientIPMatcher([NotNull] params Func<string, bool>[] funcs)
{
Check.NotNull(funcs, nameof(funcs));
Guard.NotNull(funcs, nameof(funcs));
Funcs = funcs;
}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -27,7 +27,7 @@ namespace WireMock.Matchers.Request
/// <param name="type">The CompositeMatcherType type (Defaults to 'And')</param>
protected RequestMessageCompositeMatcher([NotNull] IEnumerable<IRequestMatcher> requestMatchers, CompositeMatcherType type = CompositeMatcherType.And)
{
Check.NotNull(requestMatchers, nameof(requestMatchers));
Guard.NotNull(requestMatchers, nameof(requestMatchers));
_type = type;
RequestMatchers = requestMatchers;

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -39,8 +39,8 @@ namespace WireMock.Matchers.Request
/// <param name="matchBehaviour">The match behaviour.</param>
public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, [NotNull] string pattern, bool ignoreCase)
{
Check.NotNull(name, nameof(name));
Check.NotNull(pattern, nameof(pattern));
Guard.NotNull(name, nameof(name));
Guard.NotNull(pattern, nameof(pattern));
_matchBehaviour = matchBehaviour;
_ignoreCase = ignoreCase;
@@ -58,7 +58,7 @@ namespace WireMock.Matchers.Request
public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, bool ignoreCase, [NotNull] params string[] patterns) :
this(matchBehaviour, name, ignoreCase, patterns.Select(pattern => new WildcardMatcher(matchBehaviour, pattern, ignoreCase)).Cast<IStringMatcher>().ToArray())
{
Check.NotNull(patterns, nameof(patterns));
Guard.NotNull(patterns, nameof(patterns));
}
/// <summary>
@@ -70,8 +70,8 @@ namespace WireMock.Matchers.Request
/// <param name="ignoreCase">Ignore the case from the pattern.</param>
public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, bool ignoreCase, [NotNull] params IStringMatcher[] matchers)
{
Check.NotNull(name, nameof(name));
Check.NotNull(matchers, nameof(matchers));
Guard.NotNull(name, nameof(name));
Guard.NotNull(matchers, nameof(matchers));
_matchBehaviour = matchBehaviour;
Name = name;
@@ -85,7 +85,7 @@ namespace WireMock.Matchers.Request
/// <param name="funcs">The funcs.</param>
public RequestMessageCookieMatcher([NotNull] params Func<IDictionary<string, string>, bool>[] funcs)
{
Check.NotNull(funcs, nameof(funcs));
Guard.NotNull(funcs, nameof(funcs));
Funcs = funcs;
}

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using WireMock.Types;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -40,8 +40,8 @@ namespace WireMock.Matchers.Request
/// <param name="matchBehaviour">The match behaviour.</param>
public RequestMessageHeaderMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, [NotNull] string pattern, bool ignoreCase)
{
Check.NotNull(name, nameof(name));
Check.NotNull(pattern, nameof(pattern));
Guard.NotNull(name, nameof(name));
Guard.NotNull(pattern, nameof(pattern));
_matchBehaviour = matchBehaviour;
_ignoreCase = ignoreCase;
@@ -59,7 +59,7 @@ namespace WireMock.Matchers.Request
public RequestMessageHeaderMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, bool ignoreCase, [NotNull] params string[] patterns) :
this(matchBehaviour, name, ignoreCase, patterns.Select(pattern => new WildcardMatcher(matchBehaviour, pattern, ignoreCase)).Cast<IStringMatcher>().ToArray())
{
Check.NotNull(patterns, nameof(patterns));
Guard.NotNull(patterns, nameof(patterns));
}
/// <summary>
@@ -71,8 +71,8 @@ namespace WireMock.Matchers.Request
/// <param name="ignoreCase">Ignore the case from the pattern.</param>
public RequestMessageHeaderMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, bool ignoreCase, [NotNull] params IStringMatcher[] matchers)
{
Check.NotNull(name, nameof(name));
Check.NotNull(matchers, nameof(matchers));
Guard.NotNull(name, nameof(name));
Guard.NotNull(matchers, nameof(matchers));
_matchBehaviour = matchBehaviour;
Name = name;
@@ -86,7 +86,7 @@ namespace WireMock.Matchers.Request
/// <param name="funcs">The funcs.</param>
public RequestMessageHeaderMatcher([NotNull] params Func<IDictionary<string, string[]>, bool>[] funcs)
{
Check.NotNull(funcs, nameof(funcs));
Guard.NotNull(funcs, nameof(funcs));
Funcs = funcs;
}

View File

@@ -1,7 +1,7 @@
using System;
using System.Linq;
using JetBrains.Annotations;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -24,7 +24,7 @@ namespace WireMock.Matchers.Request
/// <param name="methods">The methods.</param>
public RequestMessageMethodMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] methods)
{
Check.NotNull(methods, nameof(methods));
Guard.NotNull(methods, nameof(methods));
_matchBehaviour = matchBehaviour;
Methods = methods;

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using WireMock.Types;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -64,7 +64,7 @@ namespace WireMock.Matchers.Request
/// <param name="matchers">The matchers.</param>
public RequestMessageParamMatcher(MatchBehaviour matchBehaviour, [NotNull] string key, bool ignoreCase, [CanBeNull] IStringMatcher[] matchers)
{
Check.NotNull(key, nameof(key));
Guard.NotNull(key, nameof(key));
_matchBehaviour = matchBehaviour;
Key = key;
@@ -78,7 +78,7 @@ namespace WireMock.Matchers.Request
/// <param name="funcs">The funcs.</param>
public RequestMessageParamMatcher([NotNull] params Func<IDictionary<string, WireMockList<string>>, bool>[] funcs)
{
Check.NotNull(funcs, nameof(funcs));
Guard.NotNull(funcs, nameof(funcs));
Funcs = funcs;
}

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -36,7 +36,7 @@ namespace WireMock.Matchers.Request
/// <param name="matchers">The matchers.</param>
public RequestMessagePathMatcher([NotNull] params IStringMatcher[] matchers)
{
Check.NotNull(matchers, nameof(matchers));
Guard.NotNull(matchers, nameof(matchers));
Matchers = matchers;
}
@@ -47,7 +47,7 @@ namespace WireMock.Matchers.Request
/// <param name="funcs">The path functions.</param>
public RequestMessagePathMatcher([NotNull] params Func<string, bool>[] funcs)
{
Check.NotNull(funcs, nameof(funcs));
Guard.NotNull(funcs, nameof(funcs));
Funcs = funcs;
}

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using WireMock.Validation;
using Stef.Validation;
namespace WireMock.Matchers.Request
{
@@ -36,7 +36,7 @@ namespace WireMock.Matchers.Request
/// <param name="matchers">The matchers.</param>
public RequestMessageUrlMatcher([NotNull] params IStringMatcher[] matchers)
{
Check.NotNull(matchers, nameof(matchers));
Guard.NotNull(matchers, nameof(matchers));
Matchers = matchers;
}
@@ -46,7 +46,7 @@ namespace WireMock.Matchers.Request
/// <param name="funcs">The url functions.</param>
public RequestMessageUrlMatcher([NotNull] params Func<string, bool>[] funcs)
{
Check.NotNull(funcs, nameof(funcs));
Guard.NotNull(funcs, nameof(funcs));
Funcs = funcs;
}