mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Refactor message service and move tests to Application.Tests
Renamed IMessageService to IMessageCommandService and updated all usages accordingly. Moved and renamed test files from Govor.API.Tests to the new Govor.Application.Tests project, updating namespaces to match. Refactored message-related services and controllers to use the new naming and structure. Added Govor.Application.Tests project to the solution.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using AutoFixture;
|
||||
using Govor.Application.Services.Authentication;
|
||||
using Govor.Core.Infrastructure.Extensions;
|
||||
|
||||
namespace Govor.Application.Tests.Services;
|
||||
|
||||
[TestFixture]
|
||||
public class PasswordHasherTests
|
||||
{
|
||||
private IPasswordHasher _passwordHasher;
|
||||
private Fixture _fixture;
|
||||
|
||||
[SetUp]
|
||||
public void StarUp()
|
||||
{
|
||||
_fixture = new Fixture();
|
||||
_passwordHasher = new PasswordHasher();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Given_Password_When_Hash_Then_Hash_And_Verify_Then_Result_Should_Be_True()
|
||||
{
|
||||
// Arrange
|
||||
string password = _fixture.Create<string>();
|
||||
|
||||
// Act
|
||||
string hash = _passwordHasher.Hash(password);
|
||||
|
||||
var result = _passwordHasher.Verify(password, hash);
|
||||
|
||||
// Assert
|
||||
Assert.That(hash, Is.Not.EqualTo(password));
|
||||
Assert.That(result, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Given_Password_NotPassword_When_Hash_Should_Not_Be_True_Then_Result_Should_Be_False()
|
||||
{
|
||||
// Arrange
|
||||
string password = _fixture.Create<string>();
|
||||
string notPassword = _fixture.Create<string>();
|
||||
|
||||
// Act
|
||||
string hash = _passwordHasher.Hash(password);
|
||||
|
||||
var result = _passwordHasher.Verify(notPassword, hash);
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.False);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user