2025-02-20 16:10:09 +03:00
|
|
|
using System;
|
2025-02-22 09:28:59 +03:00
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2025-02-20 16:10:09 +03:00
|
|
|
using Example.Shared;
|
2025-02-07 17:11:58 +03:00
|
|
|
using mROA.Implementation.Attributes;
|
|
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
namespace Example.Backend
|
2025-02-07 17:11:58 +03:00
|
|
|
{
|
2025-02-20 16:10:09 +03:00
|
|
|
[SharedObjectSingleton]
|
|
|
|
|
public class LoadTestImp : ILoadTest
|
2025-02-07 17:11:58 +03:00
|
|
|
{
|
2025-02-20 16:10:09 +03:00
|
|
|
public int Next(int last)
|
|
|
|
|
{
|
|
|
|
|
return last + 1;
|
|
|
|
|
}
|
2025-02-12 12:34:54 +03:00
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
public int Last(int next)
|
|
|
|
|
{
|
|
|
|
|
return next - 1;
|
|
|
|
|
}
|
2025-02-12 12:34:54 +03:00
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
public void C()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2025-02-12 12:34:54 +03:00
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
public void A()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2025-02-22 09:28:59 +03:00
|
|
|
|
|
|
|
|
public async Task AsyncTest(CancellationToken token)
|
|
|
|
|
{
|
2025-02-23 10:18:38 +03:00
|
|
|
Console.WriteLine("Async Test");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
if (token.IsCancellationRequested)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Waiting canceled");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine("Waiting...");
|
|
|
|
|
await Task.Delay(1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Waited until the end");
|
2025-02-22 09:28:59 +03:00
|
|
|
}
|
2025-02-12 12:34:54 +03:00
|
|
|
}
|
2025-02-07 17:11:58 +03:00
|
|
|
}
|