27 lines
862 B
C#
27 lines
862 B
C#
using Heimdall.Infrastructure.Storage;
|
|||
|
|
using Microsoft.Extensions.Options;
|
||
|
|
using Shouldly;
|
||
|
|
|
||
|
|
namespace Heimdall.Infrastructure.Tests.Storage;
|
||
|
|
|
||
|
|
public sealed class RecordingStorageQuotaOptionsTests
|
||
|
|
{
|
||
|
|
private readonly DataAnnotationValidateOptions<RecordingStorageQuotaOptions> _validator =
|
||
|
|
new(RecordingStorageQuotaOptions.SectionName);
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public void PositiveQuota_IsValid()
|
||
|
|
{
|
||
|
|
_validator.Validate(RecordingStorageQuotaOptions.SectionName,
|
||
|
|
new RecordingStorageQuotaOptions { MaxBytes = 24 }).Succeeded.ShouldBeTrue();
|
||
|
|
}
|
||
|
|
|
||
|
|
[Theory]
|
||
|
|
[InlineData(0)]
|
||
|
|
[InlineData(-1)]
|
||
|
|
public void NonPositiveQuota_IsRejected(long maxBytes)
|
||
|
|
{
|
||
|
|
_validator.Validate(RecordingStorageQuotaOptions.SectionName,
|
||
|
|
new RecordingStorageQuotaOptions { MaxBytes = maxBytes }).Failed.ShouldBeTrue();
|
||
|
|
}
|
||
|
|
}
|