Files
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

39 lines
764 B
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System.Threading.Tasks;
using HordeServer.Utilities;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace HordeServer.Tests.Utilities
{
[TestClass]
public class AsyncTaskQueueTests
{
[TestMethod]
public async Task TestQueueAsync()
{
await using AsyncTaskQueue queue = new AsyncTaskQueue(NullLogger.Instance);
bool executed1 = false;
queue.Enqueue(async _ =>
{
await Task.Yield();
executed1 = true;
});
bool executed2 = false;
queue.Enqueue(async _ =>
{
await Task.Yield();
executed2 = true;
});
await queue.FlushAsync();
Assert.IsTrue(executed1);
Assert.IsTrue(executed2);
}
}
}