mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Removes the redundant contract and enumeration tests
This commit is contained in:
1 parent
4dce426b38
commit
dc2692e208
127 files changed
-6721
No files matched your search
-67
@@ -1,67 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Requests.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="ChangePasswordRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ChangePasswordRequestTests
|
||||
{
|
||||
private readonly ChangePasswordRequestFixture _changePasswordRequestFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidChangePasswordRequest()
|
||||
{
|
||||
// Act
|
||||
ChangePasswordRequest sut = _changePasswordRequestFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Username));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.CurrentPassword));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.NewPassword));
|
||||
Assert.Equal(sut.NewPassword, sut.NewPasswordConfirm);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingChangePasswordRequest_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest expected = _changePasswordRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
ChangePasswordRequest? actual = JsonSerializer.Deserialize<ChangePasswordRequest>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest sut = _changePasswordRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
(string? username, string? currentPassword, string? newPassword, string? newPasswordConfirm) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Username, username);
|
||||
Assert.Equal(sut.CurrentPassword, currentPassword);
|
||||
Assert.Equal(sut.NewPassword, newPassword);
|
||||
Assert.Equal(sut.NewPasswordConfirm, newPasswordConfirm);
|
||||
}
|
||||
}
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Requests.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="LoginRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LoginRequestTests
|
||||
{
|
||||
private readonly LoginRequestFixture _loginRequestFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidLoginRequest()
|
||||
{
|
||||
// Act
|
||||
LoginRequest sut = _loginRequestFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Username));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Password));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingLoginRequest_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
LoginRequest expected = _loginRequestFixture.Create(totpCode: "123456");
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
LoginRequest? actual = JsonSerializer.Deserialize<LoginRequest>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
LoginRequest first = new("user1", "pass1", null);
|
||||
LoginRequest second = new("user1", "pass1", null);
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
LoginRequest sut = _loginRequestFixture.Create(username: "user1", password: "pass1", totpCode: "123456");
|
||||
|
||||
// Act
|
||||
(string? username, string? password, string? totpCode) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Username, username);
|
||||
Assert.Equal(sut.Password, password);
|
||||
Assert.Equal(sut.TotpCode, totpCode);
|
||||
}
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Requests.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="RecoverPasswordRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RecoverPasswordRequestTests
|
||||
{
|
||||
private readonly RecoverPasswordRequestFixture _recoverPasswordRequestFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidRecoverPasswordRequest()
|
||||
{
|
||||
// Act
|
||||
RecoverPasswordRequest sut = _recoverPasswordRequestFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Username));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.TotpCode));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingRecoverPasswordRequest_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
RecoverPasswordRequest expected = _recoverPasswordRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
RecoverPasswordRequest? actual = JsonSerializer.Deserialize<RecoverPasswordRequest>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
RecoverPasswordRequest sut = _recoverPasswordRequestFixture.Create(username: "user1", totpCode: "123456");
|
||||
|
||||
// Act
|
||||
(string? username, string? totpCode) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Username, username);
|
||||
Assert.Equal(sut.TotpCode, totpCode);
|
||||
}
|
||||
}
|
||||
-53
@@ -1,8 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Requests.Authentication;
|
||||
@@ -13,26 +11,6 @@ namespace Lumina.Contracts.UnitTests.Requests.Authentication;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RegistrationRequestTests
|
||||
{
|
||||
private readonly RegistrationRequestFixture _registrationRequestFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidRegistrationRequest()
|
||||
{
|
||||
// Act
|
||||
RegistrationRequest sut = _registrationRequestFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Username));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Password));
|
||||
Assert.Equal(sut.Password, sut.PasswordConfirm);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenOmittingUse2fa_ShouldDefaultToTrue()
|
||||
{
|
||||
@@ -42,35 +20,4 @@ public class RegistrationRequestTests
|
||||
// Assert
|
||||
Assert.True(sut.Use2fa);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingRegistrationRequest_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest expected = _registrationRequestFixture.Create(use2fa: true);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
RegistrationRequest? actual = JsonSerializer.Deserialize<RegistrationRequest>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest sut = _registrationRequestFixture.Create(username: "user1", password: "pass1", passwordConfirm: "pass1", use2fa: false);
|
||||
|
||||
// Act
|
||||
(string? username, string? password, string? passwordConfirm, bool use2fa) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Username, username);
|
||||
Assert.Equal(sut.Password, password);
|
||||
Assert.Equal(sut.PasswordConfirm, passwordConfirm);
|
||||
Assert.Equal(sut.Use2fa, use2fa);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user