Choose the right test project
| You’re testing… | Project to use |
|---|---|
| Domain logic / value objects | BitzOrcas.Unit.Tests |
| Mediator handler / pipeline behavior | BitzOrcas.Application.Tests |
| Full endpoint with DB | BitzOrcas.Integration.Tests |
| Module boundary / DI rule | BitzOrcas.Architecture.Tests |
Unit test pattern
public class NoteTests{ [Fact] public void Create_WithValidData_ShouldSucceed() { var note = new Note("Title", "Content"); note.Title.ShouldBe("Title"); note.DomainEvents.ShouldHaveSingleItem(); }}Integration test pattern
public class NoteEndpointTests : IClassFixture<CustomWebApplicationFactory>{ private readonly HttpClient _client;
public NoteEndpointTests(CustomWebApplicationFactory factory) { _client = factory.CreateClient(); }
[Fact] public async Task GetNotes_Returns200() { var response = await _client.GetAsync("/api/notes"); response.StatusCode.ShouldBe(HttpStatusCode.OK); }}Architecture test pattern
[Fact]public void Domain_ShouldNotDependOnInfrastructure(){ var domain = Types.InAssembly(domainAssembly); var infra = Types.InAssembly(infrastructureAssembly);
var result = domain.ShouldNot() .HaveDependencyOnAny(infra.Types) .GetResult();
result.IsSuccessful.ShouldBeTrue();}