mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Renames test methods to match SUT method names.
This commit is contained in:
1 parent
2d1c6b1ab8
commit
ac318762bf
35 files changed
+154
-154
No files matched your search
+5
-5
@@ -50,7 +50,7 @@ public class ChangePasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenPasswordChangeIsSuccessful_ShouldUpdateUserAndReturnSuccess()
|
||||
public async Task HandleAsync_WhenPasswordChangeIsSuccessful_ShouldUpdateUserAndReturnSuccess()
|
||||
{
|
||||
// Arrange
|
||||
string currentPassword = "currentPassword";
|
||||
@@ -91,7 +91,7 @@ public class ChangePasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserDoesNotExist_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUserDoesNotExist_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordCommand command = new("nonexistentUser", "oldPass", "newPass", "newPass");
|
||||
@@ -112,7 +112,7 @@ public class ChangePasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenCurrentPasswordIsIncorrect_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenCurrentPasswordIsIncorrect_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = UserEntityFixture.CreateUserEntity();
|
||||
@@ -143,7 +143,7 @@ public class ChangePasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUpdateFails_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUpdateFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string currentPassword = "currentPassword";
|
||||
@@ -181,7 +181,7 @@ public class ChangePasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string currentPassword = "currentPassword";
|
||||
|
||||
+8
-8
@@ -57,7 +57,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserExistsAndTotpIsValid_ShouldResetPassword()
|
||||
public async Task HandleAsync_WhenUserExistsAndTotpIsValid_ShouldResetPassword()
|
||||
{
|
||||
// Arrange
|
||||
string totpCode = "123456";
|
||||
@@ -97,7 +97,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserDoesNotExist_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUserDoesNotExist_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
RecoverPasswordCommand command = new("nonexistentUser", "123456");
|
||||
@@ -118,7 +118,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenTempPasswordExists_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenTempPasswordExists_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = UserEntityFixture.CreateUserEntity();
|
||||
@@ -143,7 +143,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserDoesNotUseTOTP_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUserDoesNotUseTOTP_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = UserEntityFixture.CreateUserEntity();
|
||||
@@ -167,7 +167,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenTotpCodeIsInvalid_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenTotpCodeIsInvalid_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string totpCode = "123456";
|
||||
@@ -200,7 +200,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUpdateFails_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUpdateFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string totpCode = "123456";
|
||||
@@ -236,7 +236,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string totpCode = "123456";
|
||||
@@ -264,7 +264,7 @@ public class RecoverPasswordCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserUsesTOTPButNoCodeProvided_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUserUsesTOTPButNoCodeProvided_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string encryptedTotpSecret = Convert.ToBase64String(new byte[] { 1, 2, 3 });
|
||||
|
||||
+5
-5
@@ -66,7 +66,7 @@ public class RegisterUserCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserDoesNotExistAndWith2FA_ShouldRegisterUser()
|
||||
public async Task HandleAsync_WhenUserDoesNotExistAndWith2FA_ShouldRegisterUser()
|
||||
{
|
||||
// Arrange
|
||||
RegisterUserCommand command = RegisterUserCommandFixture.CreateRegisterCommand();
|
||||
@@ -106,7 +106,7 @@ public class RegisterUserCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserDoesNotExistAndWithout2FA_ShouldRegisterUser()
|
||||
public async Task HandleAsync_WhenUserDoesNotExistAndWithout2FA_ShouldRegisterUser()
|
||||
{
|
||||
// Arrange
|
||||
RegisterUserCommand command = RegisterUserCommandFixture.CreateRegisterCommand() with { Use2fa = false };
|
||||
@@ -137,7 +137,7 @@ public class RegisterUserCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserAlreadyExists_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUserAlreadyExists_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
RegisterUserCommand command = RegisterUserCommandFixture.CreateRegisterCommand();
|
||||
@@ -159,7 +159,7 @@ public class RegisterUserCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenInsertFails_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenInsertFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
RegisterUserCommand command = RegisterUserCommandFixture.CreateRegisterCommand();
|
||||
@@ -183,7 +183,7 @@ public class RegisterUserCommandHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
RegisterUserCommand command = RegisterUserCommandFixture.CreateRegisterCommand();
|
||||
|
||||
+3
-3
@@ -57,7 +57,7 @@ public class GetUsersQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserIsNotAdmin_ShouldReturnNotAuthorizedError()
|
||||
public async Task HandleAsync_WhenUserIsNotAdmin_ShouldReturnNotAuthorizedError()
|
||||
{
|
||||
// Arrange
|
||||
GetUsersQuery query = _getUsersQueryFixture.CreateQuery();
|
||||
@@ -74,7 +74,7 @@ public class GetUsersQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenGetUsersFails_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenGetUsersFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
GetUsersQuery query = _getUsersQueryFixture.CreateQuery();
|
||||
@@ -94,7 +94,7 @@ public class GetUsersQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenAllOperationsSucceed_ShouldReturnUsers()
|
||||
public async Task HandleAsync_WhenAllOperationsSucceed_ShouldReturnUsers()
|
||||
{
|
||||
// Arrange
|
||||
GetUsersQuery query = _getUsersQueryFixture.CreateQuery();
|
||||
|
||||
+10
-10
@@ -65,7 +65,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenValidCredentialsWithoutTOTP_ShouldReturnLoginResponse()
|
||||
public async Task HandleAsync_WhenValidCredentialsWithoutTOTP_ShouldReturnLoginResponse()
|
||||
{
|
||||
// Arrange
|
||||
string password = "password123";
|
||||
@@ -97,7 +97,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenValidCredentialsWithTOTP_ShouldReturnLoginResponse()
|
||||
public async Task HandleAsync_WhenValidCredentialsWithTOTP_ShouldReturnLoginResponse()
|
||||
{
|
||||
// Arrange
|
||||
string password = "password123";
|
||||
@@ -136,7 +136,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserDoesNotExist_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUserDoesNotExist_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
LoginUserQuery query = new("nonexistentUser", "password");
|
||||
@@ -153,7 +153,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenPasswordIsIncorrect_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenPasswordIsIncorrect_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string password = "wrongPassword";
|
||||
@@ -179,7 +179,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenTempPasswordIsExpired_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenTempPasswordIsExpired_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string password = "tempPassword";
|
||||
@@ -214,7 +214,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenValidTempPassword_ShouldReturnLoginResponse()
|
||||
public async Task HandleAsync_WhenValidTempPassword_ShouldReturnLoginResponse()
|
||||
{
|
||||
// Arrange
|
||||
string password = "tempPassword";
|
||||
@@ -252,7 +252,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenUserHasTOTPButNoCodeProvided_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenUserHasTOTPButNoCodeProvided_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string password = "password123";
|
||||
@@ -279,7 +279,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenTOTPCodeIsInvalid_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenTOTPCodeIsInvalid_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string password = "password123";
|
||||
@@ -312,7 +312,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenGetByUsernameReturnsError_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
LoginUserQuery query = new("username", "password");
|
||||
@@ -330,7 +330,7 @@ public class LoginUserQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenBothRegularAndTempPasswordsAreIncorrect_ShouldReturnError()
|
||||
public async Task HandleAsync_WhenBothRegularAndTempPasswordsAreIncorrect_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
string password = "wrongPassword";
|
||||
|
||||
Reference in new issue
Block a user