Initial import

This commit is contained in:
Stein Helge Riise
2025-11-17 08:32:46 +01:00
commit ede31fbb7e
129 changed files with 9514 additions and 0 deletions
@@ -0,0 +1,63 @@
using FluentAssertions;
using MinAttest.Application.Features.Attests.Commands;
using MinAttest.Application.Features.Employers.Commands;
using MinAttest.Application.Features.Persons.Commands;
using MinAttest.Contracts.Attests;
using Xunit;
namespace MinAttest.Tests.Domain;
public class ValidationTests
{
[Fact]
public void UpsertPersonCommand_invalid_when_missing_hash()
{
var v = new UpsertPersonCommandValidator();
var r = v.Validate(new UpsertPersonCommand("", null, null));
r.IsValid.Should().BeFalse();
}
[Fact]
public void UpsertEmployerCommand_invalid_when_missing_fields()
{
var v = new UpsertEmployerCommandValidator();
var r = v.Validate(new UpsertEmployerCommand("", ""));
r.IsValid.Should().BeFalse();
}
[Fact]
public void PersonUploadAttestCommand_requires_title_and_dates()
{
var v = new PersonUploadAttestCommandValidator();
var cmd = new PersonUploadAttestCommand(Guid.NewGuid(), new PersonAttestUploadRequest(
Title: "",
From: new DateOnly(2024,12,31),
To: new DateOnly(2024,1,1),
Summary: null,
BlobPath: "",
BlobHash: null,
ContentBase64: null,
ContentType: null));
var r = v.Validate(cmd);
r.IsValid.Should().BeFalse();
}
[Fact]
public void EmployerIssueAttestCommand_requires_person_title_and_dates()
{
var v = new EmployerIssueAttestCommandValidator();
var cmd = new EmployerIssueAttestCommand(Guid.Empty, new EmployerAttestUploadRequest(
PersonId: Guid.Empty,
Title: "",
From: new DateOnly(2024,12,31),
To: new DateOnly(2024,1,1),
Summary: null,
BlobPath: "",
BlobHash: null,
ContentBase64: null,
ContentType: null));
var r = v.Validate(cmd);
r.IsValid.Should().BeFalse();
}
}