mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-23 15:46:29 +01:00
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using NUnit.Framework;
|
|
using System.Threading.Tasks;
|
|
using TINK.ViewModel;
|
|
using TINK.Settings;
|
|
|
|
namespace UITest.Fixtures.ObjectTests
|
|
{
|
|
[TestFixture]
|
|
public class TestPollingTaskManager
|
|
{
|
|
[Test]
|
|
public async Task TestStopUpdatePeriodiallyRepeated()
|
|
{
|
|
var l_oManger = new PollingUpdateTaskManager(() => "Test", () => Task.Delay(1000));
|
|
|
|
await l_oManger.StartUpdateAyncPeridically(new PollingParameters(new System.TimeSpan(0, 0, 2), true));
|
|
|
|
l_oManger.StopUpdatePeridically().Wait();
|
|
|
|
// Should not lead to dead lock.
|
|
l_oManger.StopUpdatePeridically().Wait();
|
|
}
|
|
|
|
[Test]
|
|
public async Task TestStartUpdatePeriodiallyRepeated()
|
|
{
|
|
var l_oManger = new PollingUpdateTaskManager(() => "Test", () => Task.Delay(1000));
|
|
|
|
await l_oManger.StartUpdateAyncPeridically(new PollingParameters(new System.TimeSpan(0, 0, 2), true));
|
|
|
|
// Should not lead to dead lock.
|
|
await l_oManger.StartUpdateAyncPeridically(new PollingParameters(new System.TimeSpan(0, 0, 2), true));
|
|
|
|
l_oManger.StopUpdatePeridically().Wait();
|
|
}
|
|
|
|
[Test]
|
|
public async Task TestStopUpdatePeriodiallyNoStart()
|
|
{
|
|
var l_oManger = new PollingUpdateTaskManager(() => "Test", () => Task.Delay(1000));
|
|
|
|
// Should not lead to dead lock.
|
|
await l_oManger.StartUpdateAyncPeridically(new PollingParameters(new System.TimeSpan(0, 0, 2), true));
|
|
}
|
|
}
|
|
}
|