tests: refactor test suite to match new project structure
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>FiscalOS.Infra.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AwesomeAssertions" />
|
||||
<PackageReference Include="xunit.v3.mtp-v2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\FiscalOS.Infra\FiscalOS.Infra.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,40 @@
|
||||
namespace FiscalOS.Infra.Tests.Unit;
|
||||
|
||||
public class PasswordHasherTests
|
||||
{
|
||||
private readonly PasswordHasher _sut = PasswordHasher.New();
|
||||
|
||||
[Fact]
|
||||
public void Hash_WhenGivenPassword_ShouldReturnHashedPassword()
|
||||
{
|
||||
var password = "SecurePassword123!";
|
||||
|
||||
var result = _sut.Hash(password);
|
||||
|
||||
result.Should().NotBeNullOrEmpty();
|
||||
result.Should().NotBe(password);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Verify_WhenGivenCorrectPassword_ShouldReturnTrue()
|
||||
{
|
||||
var password = "SecurePassword123!";
|
||||
var hashedPassword = _sut.Hash(password);
|
||||
|
||||
var result = _sut.Verify(password, hashedPassword);
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Verify_WhenGivenIncorrectPassword_ShouldReturnFalse()
|
||||
{
|
||||
var password = "SecurePassword123!";
|
||||
var wrongPassword = "WrongPassword!";
|
||||
var hashedPassword = _sut.Hash(password);
|
||||
|
||||
var result = _sut.Verify(wrongPassword, hashedPassword);
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
global using FiscalOS.Infra.Identity;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json"
|
||||
}
|
||||
Reference in New Issue
Block a user