Add unit tests for Environments, Audit, and Webhooks namespaces (#6)
## Summary - Add missing unit test coverage for the Environments, Audit, and Webhooks namespaces (raises them from ~0-62% to 91-100%) - Exclude WebhookBackgroundService/WebhookRetryBackgroundService from coverage (require live DI/DB, disallowed by CLAUDE.md's no-InMemory/WebApplicationFactory rule) ## Test plan - [x] `dotnet test` full suite passes (646/646) - [x] Coverage report confirms Environments ~99.5%, Audit 100%, Webhooks ~91% Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using NUnit.Framework;
|
||||
using AppEnvironment = MicCheck.Api.Environments.Environment;
|
||||
|
||||
namespace MicCheck.Api.Tests.Unit.Environments;
|
||||
|
||||
[TestFixture]
|
||||
public class EnvironmentResponseTests
|
||||
{
|
||||
[Test]
|
||||
public void WhenMappingAnEnvironment_ThenAllFieldsAreCopied()
|
||||
{
|
||||
var createdAt = DateTimeOffset.UtcNow;
|
||||
var environment = new AppEnvironment
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Production",
|
||||
ApiKey = "env-key-abc",
|
||||
ProjectId = 2,
|
||||
CreatedAt = createdAt
|
||||
};
|
||||
|
||||
var response = MicCheck.Api.Environments.EnvironmentResponse.From(environment);
|
||||
|
||||
Assert.That(response.Id, Is.EqualTo(1));
|
||||
Assert.That(response.Name, Is.EqualTo("Production"));
|
||||
Assert.That(response.ApiKey, Is.EqualTo("env-key-abc"));
|
||||
Assert.That(response.ProjectId, Is.EqualTo(2));
|
||||
Assert.That(response.CreatedAt, Is.EqualTo(createdAt));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user