diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89faa9b14..32f98070b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,9 @@ jobs: name: ${{ steps.compute-artifact-name.outputs.artifact-name }} if-no-files-found: error retention-days: 3 - path: ${{ env.TestResultsDirectory }}/**/* + path: | + **/*.binlog + ${{ env.TestResultsDirectory }}/**/* build_and_test_windows_x86: runs-on: ${{ matrix.runs-on }} @@ -184,7 +186,9 @@ jobs: name: ${{ steps.compute-artifact-name.outputs.artifact-name }} if-no-files-found: error retention-days: 3 - path: ${{ env.TestResultsDirectory }}/**/* + path: | + **/*.binlog + ${{ env.TestResultsDirectory }}/**/* test_trimming: runs-on: ubuntu-24.04 diff --git a/eng/validate-testprojects-configuration.ps1 b/eng/validate-testprojects-configuration.ps1 index f1eb0273a..911bad2a1 100644 --- a/eng/validate-testprojects-configuration.ps1 +++ b/eng/validate-testprojects-configuration.ps1 @@ -42,6 +42,10 @@ $Errors = $Projs | Foreach-Object -ThrottleLimit 5 -Parallel { if ($RefTfm -eq "netstandard2.1") { continue; } + + if ($RefTfm -eq "net462" -and $TestProjectTfms.Contains("net472")) { + continue; + } if ($RefTfm -eq "net462" -and $TestProjectTfms.Contains("net472")) { continue; diff --git a/tests/ArgumentsPrinter/ArgumentsPrinter.csproj b/tests/ArgumentsPrinter/ArgumentsPrinter.csproj index ac56000ca..69f43cf57 100644 --- a/tests/ArgumentsPrinter/ArgumentsPrinter.csproj +++ b/tests/ArgumentsPrinter/ArgumentsPrinter.csproj @@ -1,5 +1,4 @@ - Exe $(LatestTargetFrameworks) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index fe784fb2b..80c703c18 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -26,4 +26,4 @@ - \ No newline at end of file + diff --git a/tests/Meziantou.Framework.ByteSize.Tests/Meziantou.Framework.ByteSize.Tests.csproj b/tests/Meziantou.Framework.ByteSize.Tests/Meziantou.Framework.ByteSize.Tests.csproj index 6b694df6e..0b907c9c4 100644 --- a/tests/Meziantou.Framework.ByteSize.Tests/Meziantou.Framework.ByteSize.Tests.csproj +++ b/tests/Meziantou.Framework.ByteSize.Tests/Meziantou.Framework.ByteSize.Tests.csproj @@ -1,4 +1,4 @@ - + $(LatestTargetFrameworks) diff --git a/tests/Meziantou.Framework.CodeOwners.Tests/Meziantou.Framework.CodeOwners.Tests.csproj b/tests/Meziantou.Framework.CodeOwners.Tests/Meziantou.Framework.CodeOwners.Tests.csproj index 49b1caf42..6efaeca0d 100644 --- a/tests/Meziantou.Framework.CodeOwners.Tests/Meziantou.Framework.CodeOwners.Tests.csproj +++ b/tests/Meziantou.Framework.CodeOwners.Tests/Meziantou.Framework.CodeOwners.Tests.csproj @@ -1,4 +1,4 @@ - + $(LatestTargetFrameworks) diff --git a/tests/Meziantou.Framework.InlineSnapshotTesting.TaskDialog.Tests/TaskDialogPromptTests.cs b/tests/Meziantou.Framework.InlineSnapshotTesting.TaskDialog.Tests/TaskDialogPromptTests.cs index 18d2118b2..e501184da 100644 --- a/tests/Meziantou.Framework.InlineSnapshotTesting.TaskDialog.Tests/TaskDialogPromptTests.cs +++ b/tests/Meziantou.Framework.InlineSnapshotTesting.TaskDialog.Tests/TaskDialogPromptTests.cs @@ -1,11 +1,5 @@ -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Windows.Automation; -using FluentAssertions; +using System.Windows.Automation; using Meziantou.Framework.InlineSnapshotTesting.SnapshotUpdateStrategies; -using Microsoft.CodeAnalysis.CSharp.Syntax; using TestUtilities; using Xunit; @@ -89,9 +83,9 @@ internal void Ask(int buttonIndex, bool applyToAllFiles, PromptConfigurationMode { var result = Invoke(new PromptContext("path.cs", "dummy test", ParentProcessInfo: null), buttonIndex, applyToAllFiles); - result.Mode.Should().Be(expectedMode); - result.Scope.Should().Be(expectedScope); - result.RememberPeriod.Should().Be(TimeSpan.FromHours(1)); + Assert.Equal(expectedMode, result.Mode); + Assert.Equal(expectedScope, result.Scope); + Assert.Equal(TimeSpan.FromHours(1), result.RememberPeriod); } [Fact, RunIf(FactOperatingSystem.Windows)] @@ -99,8 +93,8 @@ internal void Ask_Cancel() { var result = Invoke(new PromptContext("path.cs", "dummy test", ParentProcessInfo: null), buttonIndex: 4, applyToAllFiles: false); - result.Mode.Should().Be(PromptConfigurationMode.Disallow); - result.Scope.Should().Be(PromptConfigurationScope.CurrentSnapshot); - result.RememberPeriod.Should().BeLessThanOrEqualTo(TimeSpan.Zero); + Assert.Equal(PromptConfigurationMode.Disallow, result.Mode); + Assert.Equal(PromptConfigurationScope.CurrentSnapshot, result.Scope); + Assert.True(result.RememberPeriod <= TimeSpan.Zero); } } diff --git a/tests/Meziantou.Framework.Tests/DebouceExtensionsTests.cs b/tests/Meziantou.Framework.Tests/DebounceExtensionsTests.cs similarity index 70% rename from tests/Meziantou.Framework.Tests/DebouceExtensionsTests.cs rename to tests/Meziantou.Framework.Tests/DebounceExtensionsTests.cs index 04fa2dace..d1a8dd956 100644 --- a/tests/Meziantou.Framework.Tests/DebouceExtensionsTests.cs +++ b/tests/Meziantou.Framework.Tests/DebounceExtensionsTests.cs @@ -3,20 +3,21 @@ namespace Meziantou.Framework.Tests; -public class DebouceExtensionsTests +public sealed class DebounceExtensionsTests { [Fact] public void Debounce_CallActionsWithArgumentsOfTheLastCall() { using var resetEvent = new ManualResetEventSlim(initialState: false); - int lastArg = default; + var lastArg = 0; var count = 0; var debounced = DebounceExtensions.Debounce(i => { lastArg = i; - count++; + Interlocked.CompareExchange(ref lastArg, i, 0); + Interlocked.Increment(ref count); resetEvent.Set(); - }, TimeSpan.FromMilliseconds(10)); + }, TimeSpan.FromMilliseconds(200)); debounced(1); debounced(2); diff --git a/tests/Meziantou.Framework.ValueStopwatch.Tests/Meziantou.Framework.ValueStopwatch.Tests.csproj b/tests/Meziantou.Framework.ValueStopwatch.Tests/Meziantou.Framework.ValueStopwatch.Tests.csproj index 3e57bdc7e..49f4ebc3e 100644 --- a/tests/Meziantou.Framework.ValueStopwatch.Tests/Meziantou.Framework.ValueStopwatch.Tests.csproj +++ b/tests/Meziantou.Framework.ValueStopwatch.Tests/Meziantou.Framework.ValueStopwatch.Tests.csproj @@ -1,4 +1,4 @@ - + $(LatestTargetFrameworks) diff --git a/tests/Meziantou.Framework.WPF.Tests/Meziantou.Framework.WPF.Tests.csproj b/tests/Meziantou.Framework.WPF.Tests/Meziantou.Framework.WPF.Tests.csproj index 9a566275f..c72a3227d 100644 --- a/tests/Meziantou.Framework.WPF.Tests/Meziantou.Framework.WPF.Tests.csproj +++ b/tests/Meziantou.Framework.WPF.Tests/Meziantou.Framework.WPF.Tests.csproj @@ -7,7 +7,7 @@ true - + diff --git a/tests/TestUtilities/TestUtilities.csproj b/tests/TestUtilities/TestUtilities.csproj index 4768eb9cd..03d6a34c8 100644 --- a/tests/TestUtilities/TestUtilities.csproj +++ b/tests/TestUtilities/TestUtilities.csproj @@ -17,4 +17,9 @@ + + + + +