Spaces:
Runtime error
Runtime error
Download tests/SCM.UnitTests/Projects/ProjectTests.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 1.81 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/tests/SCM.UnitTests/Projects/ProjectTests.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/tests/SCM.UnitTests/Projects/ProjectTests.cs
-
curl -L -o ProjectTests.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/tests/SCM.UnitTests/Projects/ProjectTests.cs
1.81 kB
| using FluentAssertions; | |
| using SCM.Domain.Projects; | |
| using SCM.Shared.Exceptions; | |
| using Xunit; | |
| namespace SCM.UnitTests.Projects; | |
| public class ProjectTests | |
| { | |
| private static readonly DateTime Now = new(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc); | |
| [] | |
| public void Create_DeveDefinirStatusPlanned_QuandoDadosValidos() | |
| { | |
| var project = Project.Create("OBRA-001", "Edifício Central", "desc", | |
| new DateTime(2026, 1, 1), new DateTime(2026, 12, 31), Now); | |
| project.Id.Should().NotBeEmpty(); | |
| project.Code.Should().Be("OBRA-001"); | |
| project.Status.Should().Be(ProjectStatus.Planned); | |
| project.CreatedAt.Should().Be(Now); | |
| } | |
| [] | |
| public void Create_DeveLancarDomainException_QuandoCodigoVazio() | |
| { | |
| var act = () => Project.Create(" ", "Obra", null, new DateTime(2026, 1, 1), null, Now); | |
| act.Should().Throw<DomainException>().WithMessage("*código*"); | |
| } | |
| [] | |
| public void Create_DeveLancarDomainException_QuandoTerminoAntesDoInicio() | |
| { | |
| var act = () => Project.Create("OBRA-001", "Obra", null, | |
| new DateTime(2026, 6, 10), new DateTime(2026, 6, 1), Now); | |
| act.Should().Throw<DomainException>().WithMessage("*término*"); | |
| } | |
| [] | |
| public void UpdateDetails_DeveAtualizarCamposEDefinirUpdatedAt() | |
| { | |
| var project = Project.Create("OBRA-001", "Obra", null, new DateTime(2026, 1, 1), null, Now); | |
| var later = Now.AddDays(10); | |
| project.UpdateDetails("Obra Renomeada", "nova desc", | |
| new DateTime(2026, 2, 1), new DateTime(2026, 10, 1), ProjectStatus.InProgress, later); | |
| project.Name.Should().Be("Obra Renomeada"); | |
| project.Status.Should().Be(ProjectStatus.InProgress); | |
| project.UpdatedAt.Should().Be(later); | |
| } | |
| } | |