Skip to content

Commit

Permalink
Merge pull request #199 from dorssel/parallel_tests
Browse files Browse the repository at this point in the history
Refactor unit tests
  • Loading branch information
dorssel authored May 9, 2024
2 parents 795205c + db71ce0 commit 139486b
Show file tree
Hide file tree
Showing 8 changed files with 965 additions and 570 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ obj/
TestResults/
*.user
Examples/BlazorServerPush/wwwroot/libman/
*.lutconfig
2 changes: 1 addition & 1 deletion Debounce/Generic/Debouncer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void LockedReschedule()
// We are not within any backoff interval, so we may send an event if needed.
if ((sinceLastTrigger >= _DebounceWindow) || ((_DebounceTimeout != Timeout.InfiniteTimeSpan) && sinceFirstTrigger >= _DebounceTimeout)
|| triggerCountExceeded)
{
{
// Sending event now, so accumulate all coalesced triggers.
var count = AddWithClamp(Count, Interlocked.Exchange(ref InterlockedCountMinusOne, -1) + 1);
IReadOnlyList<TData> triggerData = [];
Expand Down
1 change: 1 addition & 0 deletions Examples/TestableUnitTests/AssemblySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

[assembly: CLSCompliant(false)]
[assembly: ExcludeFromCodeCoverage]
[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]
1 change: 1 addition & 0 deletions UnitTests/AssemblySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

[assembly: CLSCompliant(false)]
[assembly: ExcludeFromCodeCoverage]
[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]
14 changes: 14 additions & 0 deletions UnitTests/CollectionAssertExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
//
// SPDX-License-Identifier: MIT

namespace UnitTests;

static class CollectionAssertExtentions
{
public static void AreEqual<TData>(this CollectionAssert customAssert, IEnumerable<TData> expected, IEnumerable<TData> actual)
{
_ = customAssert;
Assert.IsTrue(actual.SequenceEqual(expected), $"Was: [{string.Join(",", actual)}]");
}
}
Loading

0 comments on commit 139486b

Please sign in to comment.