From 12dee13a1bc9b8bafc4fc64f85119e1e05afa5fc Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Fri, 28 Jun 2024 19:08:44 +1000 Subject: [PATCH 1/2] add some StringSyntax --- src/Verify.Expecto/Verifier_Xml.cs | 3 +++ src/Verify.Fixie/Verifier_Json.cs | 3 +++ src/Verify.Fixie/Verifier_Xml.cs | 3 +++ src/Verify.MSTest/Verifier_Json.cs | 3 +++ src/Verify.MSTest/Verifier_Xml.cs | 3 +++ src/Verify.MSTest/VerifyBase_Json.cs | 3 +++ src/Verify.MSTest/VerifyBase_Xml.cs | 3 +++ src/Verify.NUnit/Verifier_Json.cs | 3 +++ src/Verify.NUnit/Verifier_Xml.cs | 3 +++ src/Verify.NUnit/VerifyBase_Json.cs | 3 +++ src/Verify.NUnit/VerifyBase_Xml.cs | 3 +++ src/Verify.Xunit/Verifier_Json.cs | 3 +++ src/Verify.Xunit/Verifier_Xml.cs | 3 +++ src/Verify.Xunit/VerifyBase_Json.cs | 3 +++ src/Verify.Xunit/VerifyBase_Xml.cs | 3 +++ src/Verify/Verifier/InnerVerifier_Json.cs | 12 +++++++++--- src/Verify/Verifier/InnerVerifier_Xml.cs | 4 +++- 17 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/Verify.Expecto/Verifier_Xml.cs b/src/Verify.Expecto/Verifier_Xml.cs index 292a6dce3f..377096f6a1 100644 --- a/src/Verify.Expecto/Verifier_Xml.cs +++ b/src/Verify.Expecto/Verifier_Xml.cs @@ -5,6 +5,7 @@ public static partial class Verifier { public static Task VerifyXml( string name, + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -12,6 +13,7 @@ public static Task VerifyXml( public static Task VerifyXml( string name, + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -19,6 +21,7 @@ public static Task VerifyXml( public static Task VerifyXml( string name, + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.Fixie/Verifier_Json.cs b/src/Verify.Fixie/Verifier_Json.cs index 6cf8d62cf7..7b281ad86a 100644 --- a/src/Verify.Fixie/Verifier_Json.cs +++ b/src/Verify.Fixie/Verifier_Json.cs @@ -4,6 +4,7 @@ public static partial class Verifier { [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.Fixie/Verifier_Xml.cs b/src/Verify.Fixie/Verifier_Xml.cs index d4072ea05d..91e54008a3 100644 --- a/src/Verify.Fixie/Verifier_Xml.cs +++ b/src/Verify.Fixie/Verifier_Xml.cs @@ -4,6 +4,7 @@ public static partial class Verifier { [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.MSTest/Verifier_Json.cs b/src/Verify.MSTest/Verifier_Json.cs index 930c4e4d74..2faf49e228 100644 --- a/src/Verify.MSTest/Verifier_Json.cs +++ b/src/Verify.MSTest/Verifier_Json.cs @@ -4,6 +4,7 @@ partial class Verifier { [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.MSTest/Verifier_Xml.cs b/src/Verify.MSTest/Verifier_Xml.cs index c89158c4e6..f0f445feac 100644 --- a/src/Verify.MSTest/Verifier_Xml.cs +++ b/src/Verify.MSTest/Verifier_Xml.cs @@ -4,6 +4,7 @@ partial class Verifier { [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.MSTest/VerifyBase_Json.cs b/src/Verify.MSTest/VerifyBase_Json.cs index 2eb0e7df4a..d97d820ddc 100644 --- a/src/Verify.MSTest/VerifyBase_Json.cs +++ b/src/Verify.MSTest/VerifyBase_Json.cs @@ -6,6 +6,7 @@ partial class VerifyBase [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -13,6 +14,7 @@ public SettingsTask VerifyJson( [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -20,6 +22,7 @@ public SettingsTask VerifyJson( [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.MSTest/VerifyBase_Xml.cs b/src/Verify.MSTest/VerifyBase_Xml.cs index 0b2825eb71..49a7039100 100644 --- a/src/Verify.MSTest/VerifyBase_Xml.cs +++ b/src/Verify.MSTest/VerifyBase_Xml.cs @@ -6,6 +6,7 @@ partial class VerifyBase [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -13,6 +14,7 @@ public SettingsTask VerifyXml( [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -20,6 +22,7 @@ public SettingsTask VerifyXml( [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.NUnit/Verifier_Json.cs b/src/Verify.NUnit/Verifier_Json.cs index 04c299a72d..9ac8b1f412 100644 --- a/src/Verify.NUnit/Verifier_Json.cs +++ b/src/Verify.NUnit/Verifier_Json.cs @@ -4,6 +4,7 @@ public static partial class Verifier { [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.NUnit/Verifier_Xml.cs b/src/Verify.NUnit/Verifier_Xml.cs index 2812859485..5ab84965eb 100644 --- a/src/Verify.NUnit/Verifier_Xml.cs +++ b/src/Verify.NUnit/Verifier_Xml.cs @@ -4,6 +4,7 @@ public static partial class Verifier { [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.NUnit/VerifyBase_Json.cs b/src/Verify.NUnit/VerifyBase_Json.cs index c4401625d5..0e6e2ff4c1 100644 --- a/src/Verify.NUnit/VerifyBase_Json.cs +++ b/src/Verify.NUnit/VerifyBase_Json.cs @@ -4,18 +4,21 @@ public partial class VerifyBase { [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] string? target, VerifySettings? settings = null) => Verifier.VerifyJson(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] Task target, VerifySettings? settings = null) => Verifier.VerifyJson(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] ValueTask target, VerifySettings? settings = null) => Verifier.VerifyJson(target, settings ?? this.settings, sourceFile); diff --git a/src/Verify.NUnit/VerifyBase_Xml.cs b/src/Verify.NUnit/VerifyBase_Xml.cs index 54533d0030..b689812a61 100644 --- a/src/Verify.NUnit/VerifyBase_Xml.cs +++ b/src/Verify.NUnit/VerifyBase_Xml.cs @@ -4,18 +4,21 @@ public partial class VerifyBase { [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null) => Verifier.VerifyXml(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null) => Verifier.VerifyXml(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null) => Verifier.VerifyXml(target, settings ?? this.settings, sourceFile); diff --git a/src/Verify.Xunit/Verifier_Json.cs b/src/Verify.Xunit/Verifier_Json.cs index 548f2c48cd..09697dc5fd 100644 --- a/src/Verify.Xunit/Verifier_Json.cs +++ b/src/Verify.Xunit/Verifier_Json.cs @@ -4,6 +4,7 @@ public static partial class Verifier { [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyJson( [Pure] public static SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.Xunit/Verifier_Xml.cs b/src/Verify.Xunit/Verifier_Xml.cs index 195b1aa9da..1f3c86a1f2 100644 --- a/src/Verify.Xunit/Verifier_Xml.cs +++ b/src/Verify.Xunit/Verifier_Xml.cs @@ -4,6 +4,7 @@ public static partial class Verifier { [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -11,6 +12,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => @@ -18,6 +20,7 @@ public static SettingsTask VerifyXml( [Pure] public static SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null, [CallerFilePath] string sourceFile = "") => diff --git a/src/Verify.Xunit/VerifyBase_Json.cs b/src/Verify.Xunit/VerifyBase_Json.cs index 9801fcdec5..db56d85186 100644 --- a/src/Verify.Xunit/VerifyBase_Json.cs +++ b/src/Verify.Xunit/VerifyBase_Json.cs @@ -4,18 +4,21 @@ public partial class VerifyBase { [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] string? target, VerifySettings? settings = null) => Verifier.VerifyJson(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] Task target, VerifySettings? settings = null) => Verifier.VerifyJson(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] ValueTask target, VerifySettings? settings = null) => Verifier.VerifyJson(target, settings ?? this.settings, sourceFile); diff --git a/src/Verify.Xunit/VerifyBase_Xml.cs b/src/Verify.Xunit/VerifyBase_Xml.cs index c9a5f8e1a8..4ef9a0bb55 100644 --- a/src/Verify.Xunit/VerifyBase_Xml.cs +++ b/src/Verify.Xunit/VerifyBase_Xml.cs @@ -4,18 +4,21 @@ public partial class VerifyBase { [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] string? target, VerifySettings? settings = null) => Verifier.VerifyXml(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] Task target, VerifySettings? settings = null) => Verifier.VerifyXml(target, settings ?? this.settings, sourceFile); [Pure] public SettingsTask VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] ValueTask target, VerifySettings? settings = null) => Verifier.VerifyXml(target, settings ?? this.settings, sourceFile); diff --git a/src/Verify/Verifier/InnerVerifier_Json.cs b/src/Verify/Verifier/InnerVerifier_Json.cs index 39cf7f8de9..87dffb16b2 100644 --- a/src/Verify/Verifier/InnerVerifier_Json.cs +++ b/src/Verify/Verifier/InnerVerifier_Json.cs @@ -2,13 +2,19 @@ partial class InnerVerifier { - public async Task VerifyJson(Task target) => + public async Task VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] + Task target) => await VerifyJson(await target); - public async Task VerifyJson(ValueTask target) => + public async Task VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] + ValueTask target) => await VerifyJson(await target); - public Task VerifyJson(string? target) + public Task VerifyJson( + [StringSyntax(StringSyntaxAttribute.Json)] + string? target) { if (target is null) { diff --git a/src/Verify/Verifier/InnerVerifier_Xml.cs b/src/Verify/Verifier/InnerVerifier_Xml.cs index e13b5e4d5e..fae1336563 100644 --- a/src/Verify/Verifier/InnerVerifier_Xml.cs +++ b/src/Verify/Verifier/InnerVerifier_Xml.cs @@ -8,7 +8,9 @@ public async Task VerifyXml(Task target) => public async Task VerifyXml(ValueTask target) => await VerifyXml(await target); - public Task VerifyXml(string? target) + public Task VerifyXml( + [StringSyntax(StringSyntaxAttribute.Xml)] + string? target) { if (target is null) { From 999651a728b7e094e80c883824e433247ddb1caf Mon Sep 17 00:00:00 2001 From: bitbonk Date: Fri, 28 Jun 2024 21:54:17 +0200 Subject: [PATCH 2/2] Fix minor typo (#1232) --- docs/wiz/Windows_Rider_Gui_Xunit_AzureDevOps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiz/Windows_Rider_Gui_Xunit_AzureDevOps.md b/docs/wiz/Windows_Rider_Gui_Xunit_AzureDevOps.md index 85d76ec348..f5623d873b 100644 --- a/docs/wiz/Windows_Rider_Gui_Xunit_AzureDevOps.md +++ b/docs/wiz/Windows_Rider_Gui_Xunit_AzureDevOps.md @@ -240,7 +240,7 @@ Directly after the test runner step add a build step to set a flag if the testru script: 'echo ##vso[task.setvariable variable=publishverify]Yes' ``` -Since the PublishBuildArtifacts step in DevOps does not allow a wildcard it is necessary to need stage the 'received' files before publishing: +Since the PublishBuildArtifacts step in DevOps does not allow a wildcard it is necessary to stage the 'received' files before publishing: ```yaml - task: CopyFiles@2