-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: TheadPoolTimer.CreatePeriodicTimer raises events properly
- Loading branch information
1 parent
ce757a2
commit 33f50d4
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/Uno.UI.RuntimeTests/Tests/Windows_System_Threading/Given_ThreadPoolTimer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Windows.ApplicationModel.Core; | ||
using Windows.System; | ||
using Windows.System.Threading; | ||
using Windows.UI.Core; | ||
|
||
namespace Uno.UI.RuntimeTests.Tests.Windows_System | ||
{ | ||
[TestClass] | ||
public class Given_ThreadPoolTimer | ||
{ | ||
[TestMethod] | ||
public async Task When_Timer() | ||
{ | ||
var handlerCount = 0; | ||
var timer = ThreadPoolTimer.CreateTimer(_ => handlerCount++, TimeSpan.FromMilliseconds(100)); | ||
|
||
await Task.Delay(500); | ||
|
||
Assert.AreEqual(handlerCount, 1); | ||
|
||
await Task.Delay(500); | ||
|
||
Assert.AreEqual(handlerCount, 1); | ||
} | ||
|
||
[TestMethod] | ||
public async Task When_PeriodicTimer() | ||
{ | ||
var handlerCount = 0; | ||
var timer = ThreadPoolTimer.CreatePeriodicTimer(_ => handlerCount++, TimeSpan.FromMilliseconds(100)); | ||
|
||
await Task.Delay(500); | ||
|
||
Assert.IsTrue(handlerCount > 1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters