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(); } }