File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
tests/Tests.CodeOfChaos.Extensions/Debouncers/Regular Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ namespace Tests.CodeOfChaos.Extensions.Debouncers.Regular;
1010// ---------------------------------------------------------------------------------------------------------------------
1111// ReSharper disable ConvertToLocalFunction
1212public class ActionDebouncerTests {
13+ private Lock Lock { get ; } = new ( ) ;
14+
1315 [ Test ]
1416 public async Task DefaultDebounceMs_ShouldBe100 ( ) {
1517 // Arrange
@@ -130,7 +132,9 @@ public async Task InvocationDuringDebounce_ShouldCancelPrevious_Action() {
130132 // Arrange
131133 var executionTimes = new List < DateTime > ( ) ;
132134 Action callback = ( ) => {
133- executionTimes . Add ( DateTime . UtcNow ) ;
135+ lock ( Lock ) {
136+ executionTimes . Add ( DateTime . UtcNow ) ;
137+ }
134138 } ;
135139
136140 // Act
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public async Task CustomDebounceMs_ShouldRespectSpecifiedTime_Func() {
3636 // Arrange
3737 int callCount = 0 ;
3838 Func < Task > callback = ( ) => {
39- callCount ++ ;
39+ Interlocked . Increment ( ref callCount ) ;
4040 return Task . CompletedTask ;
4141 } ;
4242
You can’t perform that action at this time.
0 commit comments