mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Standardizes test conventions and documentation
This commit is contained in:
1 parent
7aeed04255
commit
f42dc709de
190 files changed
+2180
-2814
No files matched your search
+5
-3
@@ -2,6 +2,7 @@
|
||||
using Lumina.Presentation.Web.Common.DTO.Configuration;
|
||||
using Lumina.Presentation.Web.Common.Primitives;
|
||||
using Lumina.Presentation.Web.Common.Validators;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Configuration;
|
||||
using Lumina.Presentation.Web.UnitTests.Common.Setup;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -16,13 +17,14 @@ namespace Lumina.Presentation.Web.UnitTests.Common.Validators;
|
||||
public class EncryptionSettingsModelValidatorTests
|
||||
{
|
||||
private const string VALID_BASE64_KEY = "FLYO0QRo6u2VzoFOgNkkEwYNGtqhJ3QGZd7iAHNEJeM=";
|
||||
private readonly EncryptionSettingsDtoFixture _encryptionSettingsDtoFixture = new();
|
||||
private readonly EncryptionSettingsDtoValidator _validator = new();
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenSecretKeyIsEmpty_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
EncryptionSettingsDto settings = new() { SecretKey = string.Empty };
|
||||
EncryptionSettingsDto settings = _encryptionSettingsDtoFixture.Create(secretKey: string.Empty);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(settings);
|
||||
@@ -35,7 +37,7 @@ public class EncryptionSettingsModelValidatorTests
|
||||
public void Validate_WhenSecretKeyIsNotBase64_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
EncryptionSettingsDto settings = new() { SecretKey = "not-base64-key!" };
|
||||
EncryptionSettingsDto settings = _encryptionSettingsDtoFixture.Create(secretKey: "not-base64-key!");
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(settings);
|
||||
@@ -48,7 +50,7 @@ public class EncryptionSettingsModelValidatorTests
|
||||
public void Validate_WhenSecretKeyIsValidBase64_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
EncryptionSettingsDto settings = new() { SecretKey = VALID_BASE64_KEY };
|
||||
EncryptionSettingsDto settings = _encryptionSettingsDtoFixture.Create(secretKey: VALID_BASE64_KEY);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(settings);
|
||||
|
||||
+6
-4
@@ -2,6 +2,7 @@
|
||||
using Lumina.Presentation.Web.Common.DTO.Configuration;
|
||||
using Lumina.Presentation.Web.Common.Primitives;
|
||||
using Lumina.Presentation.Web.Common.Validators;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Configuration;
|
||||
using Lumina.Presentation.Web.UnitTests.Common.Setup;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -15,13 +16,14 @@ namespace Lumina.Presentation.Web.UnitTests.Common.Validators;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ServerConfigurationModelValidatorTests
|
||||
{
|
||||
private readonly ServerConfigurationDtoFixture _serverConfigurationDtoFixture = new();
|
||||
private readonly ServerConfigurationDtoValidator _validator = new();
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenBaseAddressIsEmpty_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
ServerConfigurationDto configuration = new() { ApiVersion = '1', BaseAddress = string.Empty, Port = 5214 };
|
||||
ServerConfigurationDto configuration = _serverConfigurationDtoFixture.Create(apiVersion: '1', baseAddress: string.Empty, port: 5214);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(configuration);
|
||||
@@ -36,7 +38,7 @@ public class ServerConfigurationModelValidatorTests
|
||||
public void Validate_WhenPortIsAtBoundary_ShouldNotHaveValidationError(ushort port)
|
||||
{
|
||||
// Arrange
|
||||
ServerConfigurationDto configuration = new() { ApiVersion = '1', BaseAddress = "http://localhost", Port = port };
|
||||
ServerConfigurationDto configuration = _serverConfigurationDtoFixture.Create(apiVersion: '1', baseAddress: "http://localhost", port: port);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(configuration);
|
||||
@@ -51,7 +53,7 @@ public class ServerConfigurationModelValidatorTests
|
||||
public void Validate_WhenApiVersionIsAtBoundary_ShouldNotHaveValidationError(char apiVersion)
|
||||
{
|
||||
// Arrange
|
||||
ServerConfigurationDto configuration = new() { ApiVersion = apiVersion, BaseAddress = "http://localhost", Port = 5214 };
|
||||
ServerConfigurationDto configuration = _serverConfigurationDtoFixture.Create(apiVersion: apiVersion, baseAddress: "http://localhost", port: 5214);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(configuration);
|
||||
@@ -64,7 +66,7 @@ public class ServerConfigurationModelValidatorTests
|
||||
public void Validate_WhenConfigurationIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
ServerConfigurationDto configuration = new() { ApiVersion = '1', BaseAddress = "http://localhost", Port = 5214 };
|
||||
ServerConfigurationDto configuration = _serverConfigurationDtoFixture.Create(apiVersion: '1', baseAddress: "http://localhost", port: 5214);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(configuration);
|
||||
|
||||
Reference in new issue
Block a user