diff --git a/docs/converter.md b/docs/converter.md index 6b3024d7b0..217ae4c8fd 100644 --- a/docs/converter.md +++ b/docs/converter.md @@ -161,7 +161,7 @@ return new( return Task.CompletedTask; }); ``` -snippet source | anchor +snippet source | anchor diff --git a/src/DeterministicTests/DeterministicTests.csproj b/src/DeterministicTests/DeterministicTests.csproj index 7b070f0866..3147384032 100644 --- a/src/DeterministicTests/DeterministicTests.csproj +++ b/src/DeterministicTests/DeterministicTests.csproj @@ -7,10 +7,8 @@ true - - diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 976230d014..9ff309d2db 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,10 +1,11 @@ - CS1591;CS0649;xUnit1026;xUnit1013 - 14.6.2 + CS1591;CS0649;xUnit1026;xUnit1013;msb3277;CS0436 + 14.6.6 1.0.0 Json, Testing, Verify, Snapshot, Approvals Enables verification of complex models and documents. + false \ No newline at end of file diff --git a/src/DisableClipboard/DisableClipboard.csproj b/src/DisableClipboard/DisableClipboard.csproj index afefa859ca..7739390a31 100644 --- a/src/DisableClipboard/DisableClipboard.csproj +++ b/src/DisableClipboard/DisableClipboard.csproj @@ -4,10 +4,8 @@ net6 - - diff --git a/src/DisableDirScrubbing/DisableDirScrubbing.csproj b/src/DisableDirScrubbing/DisableDirScrubbing.csproj index afefa859ca..7739390a31 100644 --- a/src/DisableDirScrubbing/DisableDirScrubbing.csproj +++ b/src/DisableDirScrubbing/DisableDirScrubbing.csproj @@ -4,10 +4,8 @@ net6 - - diff --git a/src/SortedPropertiesTests/SortedPropertiesTests.csproj b/src/SortedPropertiesTests/SortedPropertiesTests.csproj index 5fed6bbee2..e80c17053f 100644 --- a/src/SortedPropertiesTests/SortedPropertiesTests.csproj +++ b/src/SortedPropertiesTests/SortedPropertiesTests.csproj @@ -4,10 +4,8 @@ net6 - - diff --git a/src/StrictJsonTests/StrictJsonTests.csproj b/src/StrictJsonTests/StrictJsonTests.csproj index 5fed6bbee2..e80c17053f 100644 --- a/src/StrictJsonTests/StrictJsonTests.csproj +++ b/src/StrictJsonTests/StrictJsonTests.csproj @@ -4,10 +4,8 @@ net6 - - diff --git a/src/Verify.DerivePaths.Tests/Verify.DerivePaths.Tests.csproj b/src/Verify.DerivePaths.Tests/Verify.DerivePaths.Tests.csproj index 54ffec0a8e..ef6f5384e4 100644 --- a/src/Verify.DerivePaths.Tests/Verify.DerivePaths.Tests.csproj +++ b/src/Verify.DerivePaths.Tests/Verify.DerivePaths.Tests.csproj @@ -4,10 +4,8 @@ net6 - - diff --git a/src/Verify.Expecto/Verify.Expecto.csproj b/src/Verify.Expecto/Verify.Expecto.csproj index 5f262d3c6c..627fc32982 100644 --- a/src/Verify.Expecto/Verify.Expecto.csproj +++ b/src/Verify.Expecto/Verify.Expecto.csproj @@ -1,19 +1,17 @@  - netstandard2.0;netstandard2.1;net5;net6 - $(NoWarn);CS0436 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net5;net6 - netstandard2.0;netstandard2.1;net461;net472;net5;net6 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net461;net472;net5;net6 - - - - + diff --git a/src/Verify.Integration.Tests/Verify.Integration.Tests.csproj b/src/Verify.Integration.Tests/Verify.Integration.Tests.csproj index 54ffec0a8e..ef6f5384e4 100644 --- a/src/Verify.Integration.Tests/Verify.Integration.Tests.csproj +++ b/src/Verify.Integration.Tests/Verify.Integration.Tests.csproj @@ -4,10 +4,8 @@ net6 - - diff --git a/src/Verify.MSTest.Tests/Verify.MSTest.Tests.csproj b/src/Verify.MSTest.Tests/Verify.MSTest.Tests.csproj index 12b28cb3ca..2febd0538b 100644 --- a/src/Verify.MSTest.Tests/Verify.MSTest.Tests.csproj +++ b/src/Verify.MSTest.Tests/Verify.MSTest.Tests.csproj @@ -9,17 +9,14 @@ net6;net48 - - - diff --git a/src/Verify.MSTest/Verify.MSTest.csproj b/src/Verify.MSTest/Verify.MSTest.csproj index 25f99b2cb2..5d002fb8b5 100644 --- a/src/Verify.MSTest/Verify.MSTest.csproj +++ b/src/Verify.MSTest/Verify.MSTest.csproj @@ -1,19 +1,15 @@  - netstandard2.0;netstandard2.1;net5;net6 - $(NoWarn);CS0436 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net5;net6 - netstandard2.0;netstandard2.1;net461;net472;net5;net6 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net461;net472;net5;net6 - - - - + diff --git a/src/Verify.NUnit.Tests/Verify.NUnit.Tests.csproj b/src/Verify.NUnit.Tests/Verify.NUnit.Tests.csproj index 347f483e01..7e040ab54c 100644 --- a/src/Verify.NUnit.Tests/Verify.NUnit.Tests.csproj +++ b/src/Verify.NUnit.Tests/Verify.NUnit.Tests.csproj @@ -9,16 +9,13 @@ net6;net48 - - - diff --git a/src/Verify.NUnit/Verify.NUnit.csproj b/src/Verify.NUnit/Verify.NUnit.csproj index 0963bd249f..e191adf55e 100644 --- a/src/Verify.NUnit/Verify.NUnit.csproj +++ b/src/Verify.NUnit/Verify.NUnit.csproj @@ -1,18 +1,15 @@  - netstandard2.0;netstandard2.1;net5;net6 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net5;net6 - netstandard2.0;netstandard2.1;net461;net472;net5;net6 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net461;net472;net5;net6 - - - - + diff --git a/src/Verify.Tests/Converters/TypeConverterTests.cs b/src/Verify.Tests/Converters/TypeConverterTests.cs index 9a8253805d..ea52331b6f 100644 --- a/src/Verify.Tests/Converters/TypeConverterTests.cs +++ b/src/Verify.Tests/Converters/TypeConverterTests.cs @@ -1,10 +1,9 @@ -using VerifyTests; +#if NET6_0 && DEBUG +using VerifyTests; using VerifyXunit; using Xunit; -#if DEBUG using System.Drawing; using System.Drawing.Imaging; -#endif [UsesVerify] public class TypeConverterTests @@ -46,7 +45,7 @@ public async Task WithStreamRequiringCleanup() VerifierSettings.RegisterFileConverter( (_, _) => { - #region ConversionResultWithCleanup +#region ConversionResultWithCleanup return new( info: info, @@ -58,7 +57,7 @@ public async Task WithStreamRequiringCleanup() return Task.CompletedTask; }); - #endregion +#endregion }); var target = new TargetForCleanup { @@ -136,7 +135,6 @@ class CanConvertTarget public string Value { get; set; } = null!; } -#if DEBUG [ModuleInitializer] public static void WithInfoInit() { @@ -240,5 +238,5 @@ static IEnumerable ConvertBmpTpPngStreams(Bitmap bitmap) bitmap.Save(stream, ImageFormat.Png); yield return stream; } -#endif -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersion.Core2_1.verified.txt b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersion.Core2_1.verified.txt new file mode 100644 index 0000000000..ba68c23f9e --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersion.Core2_1.verified.txt @@ -0,0 +1 @@ +Core2_1 \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersion.Core3_0.verified.txt b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersion.Core3_0.verified.txt new file mode 100644 index 0000000000..884d591d99 --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersion.Core3_0.verified.txt @@ -0,0 +1 @@ +Core3_0 \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersionFluent.Core2_1.verified.txt b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersionFluent.Core2_1.verified.txt new file mode 100644 index 0000000000..ba68c23f9e --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersionFluent.Core2_1.verified.txt @@ -0,0 +1 @@ +Core2_1 \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersionFluent.Core3_0.verified.txt b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersionFluent.Core3_0.verified.txt new file mode 100644 index 0000000000..884d591d99 --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.RuntimeAndVersionFluent.Core3_0.verified.txt @@ -0,0 +1 @@ +Core3_0 \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersion.Core2_1.verified.txt b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersion.Core2_1.verified.txt new file mode 100644 index 0000000000..9f26b637f0 --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersion.Core2_1.verified.txt @@ -0,0 +1 @@ +Foo \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersion.Core3_0.verified.txt b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersion.Core3_0.verified.txt new file mode 100644 index 0000000000..9f26b637f0 --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersion.Core3_0.verified.txt @@ -0,0 +1 @@ +Foo \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersionFluent.Core2_1.verified.txt b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersionFluent.Core2_1.verified.txt new file mode 100644 index 0000000000..9f26b637f0 --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersionFluent.Core2_1.verified.txt @@ -0,0 +1 @@ +Foo \ No newline at end of file diff --git a/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersionFluent.Core3_0.verified.txt b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersionFluent.Core3_0.verified.txt new file mode 100644 index 0000000000..9f26b637f0 --- /dev/null +++ b/src/Verify.Tests/Naming/NamerTests.TargetFrameworkAndVersionFluent.Core3_0.verified.txt @@ -0,0 +1 @@ +Foo \ No newline at end of file diff --git a/src/Verify.Tests/Snippets/ConverterSnippets.cs b/src/Verify.Tests/Snippets/ConverterSnippets.cs index a50624313a..d528123d7a 100644 --- a/src/Verify.Tests/Snippets/ConverterSnippets.cs +++ b/src/Verify.Tests/Snippets/ConverterSnippets.cs @@ -1,4 +1,4 @@ -#if DEBUG +#if DEBUG && NET6_0 using System.Drawing; using System.Drawing.Imaging; using VerifyTests; diff --git a/src/Verify.Tests/Verify.Tests.csproj b/src/Verify.Tests/Verify.Tests.csproj index 2a05c90a99..0282d1e622 100644 --- a/src/Verify.Tests/Verify.Tests.csproj +++ b/src/Verify.Tests/Verify.Tests.csproj @@ -1,43 +1,30 @@  - net6;netcoreapp3.1 + net6;netcoreapp3.1;netcoreapp3.0;netcoreapp2.1 true x64 $(NoWarn);CS8002 - net461;net48;net6;netcoreapp3.1 + net461;net48;net6;netcoreapp3.1;netcoreapp3.0;netcoreapp2.1 - - - - - - - - + + - PreserveNewest - - PreserveNewest - - - PreserveNewest - - + PreserveNewest diff --git a/src/Verify.Xunit.Tests/Verify.Xunit.Tests.csproj b/src/Verify.Xunit.Tests/Verify.Xunit.Tests.csproj index 805f1d4c7d..5dbf0a8d74 100644 --- a/src/Verify.Xunit.Tests/Verify.Xunit.Tests.csproj +++ b/src/Verify.Xunit.Tests/Verify.Xunit.Tests.csproj @@ -9,10 +9,8 @@ net6;net48 - - @@ -20,7 +18,6 @@ - diff --git a/src/Verify.Xunit/Verify.Xunit.csproj b/src/Verify.Xunit/Verify.Xunit.csproj index 9c280e567d..7b86c5ba00 100644 --- a/src/Verify.Xunit/Verify.Xunit.csproj +++ b/src/Verify.Xunit/Verify.Xunit.csproj @@ -1,21 +1,17 @@  - netstandard2.0;netstandard2.1;net5;net6 - $(NoWarn);CS0436 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net5;net6 - netstandard2.0;netstandard2.1;net461;net472;net5;net6 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net461;net472;net5;net6 - - - - + diff --git a/src/Verify/Compare/FileComparer.cs b/src/Verify/Compare/FileComparer.cs index 49c0dddca8..1eb8bbb0cc 100644 --- a/src/Verify/Compare/FileComparer.cs +++ b/src/Verify/Compare/FileComparer.cs @@ -57,7 +57,7 @@ static bool FilesAreSameSize(in FilePair file) static async Task DoCompare(VerifySettings settings, StreamCompare compare, FilePair filePair) { -#if NETSTANDARD2_0 || NETFRAMEWORK +#if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2_2 || NETCOREAPP2_1 using var fs1 = FileHelpers.OpenRead(filePair.Received); using var fs2 = FileHelpers.OpenRead(filePair.Verified); #else diff --git a/src/Verify/Naming/Namer.cs b/src/Verify/Naming/Namer.cs index 09a8bb2204..08a257d0b6 100644 --- a/src/Verify/Naming/Namer.cs +++ b/src/Verify/Naming/Namer.cs @@ -156,6 +156,15 @@ internal Namer(Namer namer) static (string runtime, Version Version) GetRuntimeAndVersion() { +#if NETCOREAPP2_1 + return ("Core", new Version(2, 1)); +#elif NETCOREAPP2_2 + return ("Core", new Version(2, 2)); +#elif NETCOREAPP3_0 + return ("Core", new Version(3, 0)); +#elif NETCOREAPP3_1 + return ("Core", new Version(3, 1)); +#else var description = RuntimeInformation.FrameworkDescription; if (description.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase)) @@ -164,23 +173,17 @@ internal Namer(Namer namer) return ("Net", version); } - var environmentVersion = Environment.Version; - - if (description.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase)) - { - return ("Core", environmentVersion); - } - if (description.StartsWith(".NET", StringComparison.OrdinalIgnoreCase)) { - return ("DotNet", environmentVersion); + return ("DotNet", Environment.Version); } if (description.StartsWith("Mono", StringComparison.OrdinalIgnoreCase)) { - return ("Mono", environmentVersion); + return ("Mono", Environment.Version); } throw new($"Could not resolve runtime for '{description}'."); +#endif } } \ No newline at end of file diff --git a/src/Verify/Serialization/Scrubbers/ApplyScrubbers.cs b/src/Verify/Serialization/Scrubbers/ApplyScrubbers.cs index 216b689673..8539d8fc42 100644 --- a/src/Verify/Serialization/Scrubbers/ApplyScrubbers.cs +++ b/src/Verify/Serialization/Scrubbers/ApplyScrubbers.cs @@ -8,7 +8,7 @@ static class ApplyScrubbers static ApplyScrubbers() { - var baseDirectory = CleanPath(AppDomain.CurrentDomain.BaseDirectory); + var baseDirectory = CleanPath(AppDomain.CurrentDomain.BaseDirectory!); var altBaseDirectory = baseDirectory.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); currentDirectoryReplacements.Add(baseDirectory + Path.DirectorySeparatorChar); currentDirectoryReplacements.Add(altBaseDirectory + Path.AltDirectorySeparatorChar); diff --git a/src/Verify/Verifier/InnerVerifier_Stream.cs b/src/Verify/Verifier/InnerVerifier_Stream.cs index 6786e22a15..9353cea10f 100644 --- a/src/Verify/Verifier/InnerVerifier_Stream.cs +++ b/src/Verify/Verifier/InnerVerifier_Stream.cs @@ -11,7 +11,7 @@ public Task Verify(byte[] target) async Task VerifyStream(Stream stream) { var extension = settings.extension; -#if NETSTANDARD2_0 || NETFRAMEWORK +#if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2_2 || NETCOREAPP2_1 using (stream) #else await using (stream) diff --git a/src/Verify/Verifier/VerifyEngine.cs b/src/Verify/Verifier/VerifyEngine.cs index 881337aa82..67b4ed7c5b 100644 --- a/src/Verify/Verifier/VerifyEngine.cs +++ b/src/Verify/Verifier/VerifyEngine.cs @@ -40,7 +40,7 @@ static async Task GetResult(VerifySettings settings, FilePair fi } var stream = target.StreamData; -#if NETSTANDARD2_0 || NETFRAMEWORK +#if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2_2 || NETCOREAPP2_1 using (stream) #else await using (stream) diff --git a/src/Verify/Verify.csproj b/src/Verify/Verify.csproj index 86cf009d03..9dea0f7094 100644 --- a/src/Verify/Verify.csproj +++ b/src/Verify/Verify.csproj @@ -1,24 +1,27 @@  - netstandard2.0;netstandard2.1;net5;net6 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net5;net6 - netstandard2.0;netstandard2.1;net461;net472;net5;net6 + netstandard2.0;netstandard2.1;netcoreapp3.1;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;net461;net472;net5;net6 - + - - - + + + + + + \ No newline at end of file diff --git a/src/Verify/VerifySettings.cs b/src/Verify/VerifySettings.cs index f3c6f49dc4..5fd1fac2b1 100644 --- a/src/Verify/VerifySettings.cs +++ b/src/Verify/VerifySettings.cs @@ -32,11 +32,11 @@ public VerifySettings(VerifySettings? settings) { if (append.Data is ICloneable cloneable) { - Context.Add(append.Name, cloneable.Clone()); + AppendValue(append.Name, cloneable.Clone()); } else { - Context.Add(append.Name, append.Data); + AppendValue(append.Name, append.Data); } } foreach (var pair in settings.Context)