mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
6d1c53beeb
Large refactor that renames/moves core types into a new Govor.Domain surface and reorganizes the Application layer. Models, configurations, migrations and many files moved from Govor.Core/Govor.Data to Govor.Domain; numerous Application services, interfaces and implementations were relocated or added (authentication, friends, messages, medias, push notifications, user sessions, storage, synching, private chats, etc.). Tests updated to use Govor.Domain namespaces and adjusted project references (removed Govor.Data reference from API tests). Also updated API, Hub and mapping code and project files to reflect the new structure and naming. This is primarily a codebase-wide namespace and module reorganization to establish a Domain project and restructure application services.
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using AutoFixture;
|
|
using Govor.Application.Services.Authentication;
|
|
using Govor.Domain.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);
|
|
}
|
|
} |