tests: refactor test suite to match new project structure

This commit is contained in:
Stevan Freeborn
2026-02-03 04:38:40 -06:00
parent c2b681d267
commit 38a03f56ca
9 changed files with 50 additions and 12 deletions
@@ -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();
}
}
+1
View File
@@ -0,0 +1 @@
global using FiscalOS.Infra.Identity;
@@ -0,0 +1,3 @@
{
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json"
}