Files
aliasvault/apps/server/Tests/AliasVault.IntegrationTests/StatusHostedService/TestExceptionWorker.cs
2025-09-03 14:59:14 +02:00

24 lines
911 B
C#

//-----------------------------------------------------------------------
// <copyright file="TestExceptionWorker.cs" company="aliasvault">
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------
namespace AliasVault.IntegrationTests.StatusHostedService;
using Microsoft.Extensions.Hosting;
/// <summary>
/// A simple worker that throws an exception during task execution. This is used for testing purposes.
/// </summary>
public class TestExceptionWorker() : BackgroundService
{
/// <inheritdoc/>
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await Task.Delay(TimeSpan.FromMilliseconds(100), stoppingToken);
throw new Exception("Test exception");
}
}