mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 06:11:10 +00:00
Renames project paths from Lumina to Nemera
This commit is contained in:
1 parent
ce6fddb4c9
commit
0f659a4877
6450 files changed
No files matched your search
+124
@@ -0,0 +1,124 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.Configuration;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Infrastructure.Common.Errors;
|
||||
using Lumina.Infrastructure.Common.Validators;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.UnitTests.Common.Validators;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="MediaSettingsDtoValidator"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MediaSettingsDtoValidatorTests
|
||||
{
|
||||
private readonly MediaSettingsDtoValidator _validator = new();
|
||||
private readonly IFixture _fixture;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaSettingsDtoValidatorTests"/> class.
|
||||
/// </summary>
|
||||
public MediaSettingsDtoValidatorTests()
|
||||
{
|
||||
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenRootDirectoryProvided_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
MediaSettingsDto model = _fixture.Build<MediaSettingsDto>()
|
||||
.With(x => x.RootDirectory, "/path/to/media")
|
||||
.Create();
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.Validate(model);
|
||||
|
||||
// Assert
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenRootDirectoryIsEmpty_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
MediaSettingsDto model = _fixture.Build<MediaSettingsDto>()
|
||||
.With(x => x.RootDirectory, string.Empty)
|
||||
.Create();
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.Validate(model);
|
||||
|
||||
// Assert
|
||||
Assert.Single(result);
|
||||
Assert.Equal(Errors.Configuration.MediaRootDirectoryCannotBeEmpty.Description, result[0].Description);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenRootDirectoryIsWhitespace_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
MediaSettingsDto model = _fixture.Build<MediaSettingsDto>()
|
||||
.With(x => x.RootDirectory, " ")
|
||||
.Create();
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.Validate(model);
|
||||
|
||||
// Assert
|
||||
Assert.Single(result);
|
||||
Assert.Equal(Errors.Configuration.MediaRootDirectoryCannotBeEmpty.Description, result[0].Description);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenMediaLibrariesDirectoryIsEmpty_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
MediaSettingsDto model = _fixture.Build<MediaSettingsDto>()
|
||||
.With(x => x.LibrariesDirectory, string.Empty)
|
||||
.Create();
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.Validate(model);
|
||||
|
||||
// Assert
|
||||
Assert.Single(result);
|
||||
Assert.Equal(Errors.Configuration.MediaLibrariesDirectoryCannotBeEmpty.Description, result[0].Description);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenMediaLibrariesDirectoryProvided_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
MediaSettingsDto model = _fixture.Build<MediaSettingsDto>()
|
||||
.With(x => x.LibrariesDirectory, "/path/to/media")
|
||||
.Create();
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.Validate(model);
|
||||
|
||||
// Assert
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenMediaLibrariesDirectoryIsWhitespace_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
MediaSettingsDto model = _fixture.Build<MediaSettingsDto>()
|
||||
.With(x => x.LibrariesDirectory, " ")
|
||||
.Create();
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.Validate(model);
|
||||
|
||||
// Assert
|
||||
Assert.Single(result);
|
||||
Assert.Equal(Errors.Configuration.MediaLibrariesDirectoryCannotBeEmpty.Description, result[0].Description);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user