mirror of https://github.com/abpframework/abp.git
4 changed files with 0 additions and 146 deletions
@ -1,20 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.test.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net10.0</TargetFramework> |
|||
<AssemblyName>Volo.Abp.BackgroundWorkers.TickerQ.Tests</AssemblyName> |
|||
<PackageId>Volo.Abp.BackgroundWorkers.TickerQ.Tests</PackageId> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Volo.Abp.BackgroundWorkers.TickerQ\Volo.Abp.BackgroundWorkers.TickerQ.csproj" /> |
|||
<ProjectReference Include="..\..\src\Volo.Abp.BackgroundWorkers\Volo.Abp.BackgroundWorkers.csproj" /> |
|||
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" /> |
|||
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" /> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -1,13 +0,0 @@ |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.BackgroundWorkers.TickerQ; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpBackgroundWorkersTickerQModule), |
|||
typeof(AbpTestBaseModule), |
|||
typeof(AbpAutofacModule) |
|||
)] |
|||
public class AbpBackgroundWorkersTickerQTestModule : AbpModule |
|||
{ |
|||
} |
|||
@ -1,69 +0,0 @@ |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Shouldly; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.BackgroundWorkers.TickerQ; |
|||
|
|||
public class TickerQBackgroundWorkerBase_Tests : AbpIntegratedTest<AbpBackgroundWorkersTickerQTestModule> |
|||
{ |
|||
[Fact] |
|||
public void Should_Have_Default_Properties() |
|||
{ |
|||
// Arrange & Act
|
|||
var worker = new TestTickerQWorker(); |
|||
|
|||
// Assert
|
|||
worker.AutoRegister.ShouldBeTrue(); |
|||
worker.Priority.ShouldBe(0); |
|||
worker.MaxRetryAttempts.ShouldBe(3); |
|||
worker.JobId.ShouldBeNull(); |
|||
worker.CronExpression.ShouldBeNull(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Allow_Custom_Configuration() |
|||
{ |
|||
// Arrange & Act
|
|||
var worker = new TestTickerQWorker |
|||
{ |
|||
JobId = "CustomJobId", |
|||
CronExpression = "0 0 12 * * ?", |
|||
Priority = 5, |
|||
MaxRetryAttempts = 10, |
|||
AutoRegister = false |
|||
}; |
|||
|
|||
// Assert
|
|||
worker.JobId.ShouldBe("CustomJobId"); |
|||
worker.CronExpression.ShouldBe("0 0 12 * * ?"); |
|||
worker.Priority.ShouldBe(5); |
|||
worker.MaxRetryAttempts.ShouldBe(10); |
|||
worker.AutoRegister.ShouldBeFalse(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_Execute_DoWorkAsync() |
|||
{ |
|||
// Arrange
|
|||
var worker = new TestTickerQWorker(); |
|||
|
|||
// Act
|
|||
await worker.DoWorkAsync(); |
|||
|
|||
// Assert
|
|||
worker.ExecutionCount.ShouldBe(1); |
|||
} |
|||
|
|||
private class TestTickerQWorker : TickerQBackgroundWorkerBase |
|||
{ |
|||
public int ExecutionCount { get; private set; } |
|||
|
|||
public override Task DoWorkAsync(CancellationToken cancellationToken = default) |
|||
{ |
|||
ExecutionCount++; |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
|||
@ -1,44 +0,0 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Options; |
|||
using Shouldly; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.BackgroundWorkers.TickerQ; |
|||
|
|||
public class TickerQBackgroundWorkerManager_Tests : AbpIntegratedTest<AbpBackgroundWorkersTickerQTestModule> |
|||
{ |
|||
private readonly IBackgroundWorkerManager _backgroundWorkerManager; |
|||
private readonly IOptions<AbpBackgroundWorkerTickerQOptions> _options; |
|||
|
|||
public TickerQBackgroundWorkerManager_Tests() |
|||
{ |
|||
_backgroundWorkerManager = GetRequiredService<IBackgroundWorkerManager>(); |
|||
_options = GetRequiredService<IOptions<AbpBackgroundWorkerTickerQOptions>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Use_TickerQBackgroundWorkerManager() |
|||
{ |
|||
// Assert
|
|||
_backgroundWorkerManager.ShouldBeOfType<TickerQBackgroundWorkerManager>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Have_Default_Options() |
|||
{ |
|||
// Assert
|
|||
var options = _options.Value; |
|||
options.IsAutoRegisterEnabled.ShouldBeTrue(); |
|||
options.DefaultCronExpression.ShouldBe("0 * * ? * *"); |
|||
options.DefaultMaxRetryAttempts.ShouldBe(3); |
|||
options.DefaultPriority.ShouldBe(0); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Allow_Options_Configuration() |
|||
{ |
|||
// This test would be run in a separate test module with different options
|
|||
// For now, just verify the options exist
|
|||
_options.Value.ShouldNotBeNull(); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue