diff --git a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md
index 67bf1bb..ff41e1f 100644
--- a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md
+++ b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md
@@ -251,9 +251,9 @@
name: string [NotNull, NotNull]
) : string [Extension, CanBeNull, AssertionMethod, ContractAnnotation]
- Fail.OrFailIfWhiteSpace(
- value: string? [Nullable, AssertionCondition, NoEnumeration],
- name: string [NotNull, NotNull, CallerArgumentExpression, Optional]
- ) : string [Extension, NotNull, AssertionMethod, ContractAnnotation]
+ value: string? [AssertionCondition, NoEnumeration],
+ name: string? [CallerArgumentExpression, Optional]
+ ) : string [NullableContext, Extension, NotNull, AssertionMethod, ContractAnnotation]
## Requirements.Business (abstract class)
- Business.Requires(
diff --git a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md
index 9d9e0d5..ff41e1f 100644
--- a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md
+++ b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md
@@ -251,9 +251,9 @@
name: string [NotNull, NotNull]
) : string [Extension, CanBeNull, AssertionMethod, ContractAnnotation]
- Fail.OrFailIfWhiteSpace(
- value: string? [Nullable, AssertionCondition, NoEnumeration],
- name: string [NotNull, NotNull]
- ) : string [Extension, NotNull, AssertionMethod, ContractAnnotation]
+ value: string? [AssertionCondition, NoEnumeration],
+ name: string? [CallerArgumentExpression, Optional]
+ ) : string [NullableContext, Extension, NotNull, AssertionMethod, ContractAnnotation]
## Requirements.Business (abstract class)
- Business.Requires(
diff --git a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md
index 9d9e0d5..ff41e1f 100644
--- a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md
+++ b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md
@@ -251,9 +251,9 @@
name: string [NotNull, NotNull]
) : string [Extension, CanBeNull, AssertionMethod, ContractAnnotation]
- Fail.OrFailIfWhiteSpace(
- value: string? [Nullable, AssertionCondition, NoEnumeration],
- name: string [NotNull, NotNull]
- ) : string [Extension, NotNull, AssertionMethod, ContractAnnotation]
+ value: string? [AssertionCondition, NoEnumeration],
+ name: string? [CallerArgumentExpression, Optional]
+ ) : string [NullableContext, Extension, NotNull, AssertionMethod, ContractAnnotation]
## Requirements.Business (abstract class)
- Business.Requires(
diff --git a/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs b/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs
index f5ae40b..8de21a3 100644
Binary files a/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs and b/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs differ
diff --git a/Contracts/Synergy.Contracts/Failures/FailString.cs b/Contracts/Synergy.Contracts/Failures/FailString.cs
index 6e5fdbb..927c3eb 100644
--- a/Contracts/Synergy.Contracts/Failures/FailString.cs
+++ b/Contracts/Synergy.Contracts/Failures/FailString.cs
@@ -106,17 +106,19 @@ string argumentName
/// Value to check against nullability and white space.
/// Name of the checked argument / parameter to check.
/// Exactly the same value as provided to this method.
- [NotNull] [return: System.Diagnostics.CodeAnalysis.NotNull]
+ [NotNull]
+ [return: System.Diagnostics.CodeAnalysis.NotNull]
[AssertionMethod]
[ContractAnnotation("value: null => halt; value: notnull => notnull")]
public static string OrFailIfWhiteSpace(
- [AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [NoEnumeration] this string? value,
-#if NET6_0
- [NotNull] [System.Diagnostics.CodeAnalysis.NotNull][System.Runtime.CompilerServices.CallerArgumentExpression("value")] string name = ""
+ [AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [NoEnumeration]
+ this string? value,
+#if NET6_0_OR_GREATER
+ [System.Runtime.CompilerServices.CallerArgumentExpression("value")] string? name = null
#else
- [NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string name
+ string name
#endif
- )
+ )
{
Fail.RequiresArgumentName(name);
@@ -136,7 +138,8 @@ [NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string name
[ContractAnnotation("value: null => halt")]
public static void IfWhitespace(
[CanBeNull, AssertionCondition(AssertionConditionType.IS_NOT_NULL)] string value,
- [NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string name)
+ [NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string name
+ )
{
Fail.RequiresArgumentName(name);
Fail.IfWhitespace(value, Violation.WhenWhitespace(name));
diff --git a/Web/Synergy.Web.Api.Testing/Assertions/Assertion.cs b/Web/Synergy.Web.Api.Testing/Assertions/Assertion.cs
index 750ad46..9d450e1 100644
--- a/Web/Synergy.Web.Api.Testing/Assertions/Assertion.cs
+++ b/Web/Synergy.Web.Api.Testing/Assertions/Assertion.cs
@@ -12,7 +12,7 @@ public abstract class Assertion : IAssertion
public IAssertion Expected(string expected)
{
- ExpectedResult = expected.OrFailIfWhiteSpace(nameof(expected));
+ ExpectedResult = expected.OrFailIfWhiteSpace();
return this;
}
@@ -27,7 +27,7 @@ public struct Result
public Result([NotNull] string message)
{
- Message = message.OrFailIfWhiteSpace(nameof(message)).Trim();
+ Message = message.OrFailIfWhiteSpace().Trim();
}
public static Result Ok => new Result(OkMessage);
diff --git a/Web/Synergy.Web.Api.Testing/HttpOperation.cs b/Web/Synergy.Web.Api.Testing/HttpOperation.cs
index 4adce38..92cb054 100644
--- a/Web/Synergy.Web.Api.Testing/HttpOperation.cs
+++ b/Web/Synergy.Web.Api.Testing/HttpOperation.cs
@@ -41,7 +41,7 @@ internal void Assert(IEnumerable assertions)
internal void SetDescription([NotNull] string details)
{
- Description = details.OrFailIfWhiteSpace(nameof(details));
+ Description = details.OrFailIfWhiteSpace();
}
}
}
\ No newline at end of file
diff --git a/Web/Synergy.Web.Api.Testing/HttpOperationExtensions.cs b/Web/Synergy.Web.Api.Testing/HttpOperationExtensions.cs
index 05e5300..0018aef 100644
--- a/Web/Synergy.Web.Api.Testing/HttpOperationExtensions.cs
+++ b/Web/Synergy.Web.Api.Testing/HttpOperationExtensions.cs
@@ -9,7 +9,7 @@ public static class HttpOperationExtensions
public static TOperation Details(this TOperation operation, string details)
where TOperation : HttpOperation
{
- operation.SetDescription(details.OrFailIfWhiteSpace(nameof(details)));
+ operation.SetDescription(details.OrFailIfWhiteSpace());
return operation;
}